mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jan 2003
Posts: 1
M
madmoo Offline OP
Mostly harmless
OP Offline
Mostly harmless
M
Joined: Jan 2003
Posts: 1
Does anyone know how to set up mirc to autorespond to a private message recieved while I'm away. e.g If I receieve a pm mirc will auto reply to the sender with preset message?


Joined: Dec 2002
Posts: 395
M
Fjord artisan
Offline
Fjord artisan
M
Joined: Dec 2002
Posts: 395
There is an IRC feature - /away.
Set yourself /away <reason> and everyone who pm you will get away info. wink

Joined: Dec 2002
Posts: 2,985
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 2,985
Here's my way, including a hash table based flood protection:
Code:
ON ^*:OPEN:?: {
  if ($hget(flood,flood) == $null) {
    .hadd -sm flood flood 1
    echo $colour(info) -ta $nick has opened a private chat with you
    .timer 1 5 .hfree -sw flood
  }
}

It will just send one message to those querying you and only works every five seconds which helps to stop clones flooding you off.

Joined: Dec 2002
Posts: 191
N
Vogon poet
Offline
Vogon poet
N
Joined: Dec 2002
Posts: 191
just a couple of questions.
1 Why use a timer to remove the hash table entry when the -u swith would do it just as well.
2 Why use the -s switch then have the command pefixed with . to hide the output.

Joined: Dec 2002
Posts: 2,985
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 2,985
I just tested that, thankyou.

Code:
ON ^*:OPEN:?: {
  if ($hget(flood,flood) == $null) {
    hadd -mu5 flood flood 1
    echo $colour(info) -ta $nick has opened a private chat with you
  }
}


This looks alot better.

Joined: Dec 2002
Posts: 699
N
Fjord artisan
Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 699
One question, and one comment.
Question: Why use a hash table for that at all?
Comment: That script does not send any messages, whether away is set or not.
laugh

Joined: Dec 2002
Posts: 2,985
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 2,985
Hash tables are fast which is why I used it for a switch. I didn't see his request about 'only when away' so that's something I overlooked :tongue:
Code:
ON ^*:OPEN:?: {
  if ($hget(flood,flood) == $null &amp;&amp; $away == $true) {
    hadd -mu5 flood flood 1
    echo $colour(info) -ta $nick has opened a private chat with you
  }
}

Two heads are better than one. grin

Joined: Dec 2002
Posts: 699
N
Fjord artisan
Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 699
Hash tables are a very efficient way to access large amounts of data. Variables are also held in memory, so they too are fast, and much more suited to single items. smile
Quote:
Does anyone know how to set up mirc to autorespond to a private message recieved while I'm away.
Pretty much says "I want to send an auto-msg when I am set away", don't you think? laugh
It does NOT say "I want to to notify myself of one PM per 5 seconds", which is what your script does (that and only that) :tongue:

Joined: Dec 2002
Posts: 699
N
Fjord artisan
Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 699
This will respond with I am away [reason] [Gone: X mins]
Code:
on *:text:*:?:msgaway
on *:action:*:?:msgaway
alias msgaway {
  if (!$away) || ($eval($+(%,awaymsg.,$cid,$site),2)) return
  msg $nick [color:blue]I am away $+([,$awaymsg,] [Gone: $duration($awaytime,2),])[/color]
  inc -u[color:red]120[/color] $+(%,awaymsg.,$cid,$site)
}
Change the 120 to how many seconds you prefer between auto-messaging the user.

Joined: Dec 2002
Posts: 2,985
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 2,985
Pretty much says "I want to send an auto-msg when I am set away", don't you think?

I'm not drunk, I promise lol. It's just the odd hours I keep. My intentions were good, I just pasted the wrong stuff hehe. The real reason is that this script is cut down from a 40 line script that I use, which has multiple available replies, selectable from a dialogue. In my efforts to make life easy I just grabbed the wrong line.

Okay, it's all done now but I will paste here what I first intended (we've come this far after all)...

Code:
ON ^*:OPEN:?: {
  if ($hget(flood,flood) == $null &amp;&amp; $away == $true) {
    hadd -mu5 flood flood 1
    notice $nick I have received your message and will reply in due course...
  }
}

Now, as for variables, yes they are fast though there is still visible lag if variables are set while mIRC is doing other things. It depends on how heavy your script is of course but since I am an oper my script is rather heavy. Anyway, I've learnt two things today 1. about the -u timer which I thought only applied to a few other things and 2. that I should pay more attention to what I paste.

*Watchdog is very humble blush


Link Copied to Clipboard