mIRC Homepage
Posted By: NaquadaServ Another use for signals... - 12/12/02 06:30 PM
Here is another use for signals...

Do you find scripting raw's a daunting task? Not sure what numeric 420 is? Here is your solution... Use a hash table to assign text labels to raw numerics and use those text labels in signal events. This is a simplified rewrite of what I'm doing and has not actually been tested for any bugs...

raw *:*:{
var %NoHaltNums 321,322,323,364,365,372
var %Numeric $str(0, $calc(3 - $len($numeric))) $+ $numeric
.signal $rsignal(%Numeric)
if ($istok(%NoHaltNums, %Numeric, 44) == $false) { haltdef }
}
on *:SIGNAL:RPL_UMODEIS:{ echo -a Modes for $me $+ : $2 }
; These two signal events are the last two raw signal events...
on *:SIGNAL:RPL_*:{ echo -s Warning: Undefined raw reply signal, $signal }
on *:SIGNAL:ERR_*:{ echo -s Error: Undefined raw error signal, $signal }

alias rsignal {
var %Raw
if ($hget(RawDefs) == $null) { raw.defs }
set %Raw $gettok($hget(RawDefs, $1), 1, 32)
return $iif(%Raw != $null, %Raw, ERR_BAD_NUMERIC)
}
alias -l raw.defs {
var %D hadd RawDefs
%D 001 RPL_WELCOME
%D 002 RPL_SECHO RPL_YOURHOST
; Second token (RPL_YOURHOST) above is an actual descriptive text, but RPL_SECHO is the signal being used. In my scripts, It's a common signal to many raw events...
; Etc, Etc, Etc...
}
© mIRC Discussion Forums