mIRC Home    About    Download    Register    News    Help

Print Thread
#12838 24/02/03 02:38 PM
Joined: Dec 2002
Posts: 3
K
kenny Offline OP
Self-satisified door
OP Offline
Self-satisified door
K
Joined: Dec 2002
Posts: 3
seems that lots of users use autoaway scripts... and it would be easier to create commands for autoaway


xmas comin'
#12839 24/02/03 07:54 PM
Joined: Dec 2002
Posts: 169
J
Vogon poet
Offline
Vogon poet
J
Joined: Dec 2002
Posts: 169
A command to do what exactly? Do you mean a new option to automatically set yourself away after X idle seconds? That is easily scripted.

#12840 01/03/03 03:47 PM
Joined: Feb 2003
Posts: 372
R
Fjord artisan
Offline
Fjord artisan
R
Joined: Feb 2003
Posts: 372
A more interesting thing would be a function to filter autoaways OUT as you receive them.

After all, you should see an away msg the first time you privmsg that user, and also the idle time using /whois user user .

#12841 02/03/03 02:00 PM
Joined: Dec 2002
Posts: 1,321
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Dec 2002
Posts: 1,321
I block 301's entirely. I don't care if you're /away.
Code:

raw 301:*: halt

However, your idea would be simple to script. When you receive a 301 for them, add the text of the message to hash table; this will be ideal since the only time all your values will only be reset if you 1) exit mIRC (no need to save the hash table), or 2) manually (or through a popup) free the table. The only time you will see their away message is the first 301 you get for them, either by sending them a message and having the server send it back to you or by /whois-ing them; if their away message changes, you will see the message again.

A simple idea for deciding which window to send the away message to would be like this:
  1. If you have an open query window for them, put it in there; or,
  2. if you don't, but share common channels with them, put it in all of the common channels; or,
  3. if neither of those two, put it in the status window.
Code:

raw 301:*:{
  [color:#005500]
  ;  These variables are only used to make the event more self-descriptive.
  [/color]
  var %Nick = $2               | ; Replaces $nick with %Nick.
  var %AwayMsg = $3-           | ; Holds the text of the away message.
  var %i = 1                   | ; Loop index for cycling through common channels.
  [color:#005500]
  ;  Compare any stored AwayMsg you have for this nick with the current one. If you have already seen this
  ;  message, halt the script: no need to proceed.
  [/color]
  if %AwayMsg == $hget(AwayMsg, $+($network, ., %Nick)) halt
  [color:#005500]
  ;  Since you haven't seen this message, store it for the next time you get a 301 from them.
  [/color]
  hadd -m AwayMsg $+($network, ., %Nick) %AwayMsg
  [color:#005500]
  ;  Now decide where to echo this 301 to: query or status window, or common channels. If you have an open
  ;  query window with them or if you are not in any common channels with them:
  [/color]
  if $query(%Nick) == %Nick || $comchan(%Nick, 0) != 0 {
    echo $color(whois) $iif($query(%Nick), -mbflirt %Nick, -smbflirt) * %nick is away: %AwayMsg
  }
  [color:#005500]
  ;  Otherwise, you share common channels with them. Loop through each and echo to each.
  [/color]
  else while $comchan(%Nick, %i) { 
    echo $color(whois) -mbflirt $ifmatch * %Nick is away: %AwayMsg
    inc %i 
  }
  [color:#005500]
  ;  Now halt the default text.
  [/color]
  halt
}

When you restart your mIRC each time, the AwayMsg hash table "goes softly and silently away": garbage collection at its finest!

If you wanted to, though, you could hsave the table on EXIT and reload it on START. You would need to implement some method of clearing out stale members occasionally. You might store the $ctime (or $gmt) of the last time you saw that 301 in addition to the text of the message. Then on DISCONNECT, you might do a little cleanup for each item from that $network whose value was greater than 1 day (86400 seconds) or whatever you choose.

The above script is rather polluted with comments. Here it is without comments (to make it easier to paste) and unnecessary variables.
Code:

raw 301:*:{
  if $3- != $hget(AwayMsg,$+($network,.,$2)) {
    hadd -m AwayMsg $+($network,.,$2) $3-
    var %i = 1
    if ($query($2)) || (!$comchan($2,0)) echo $color(whois) $iif($query($2),-mbflirt $2,-smbflirt) * $2 is away: $3-
    else while $comchan($2,%i) { echo $color(whois) -mbflirt $ifmatch * $2 is away: $3- | inc %i  }
  }
  halt
}


DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C

Link Copied to Clipboard