#DEBUG.EVENTS off
on *:KEYDOWN:*:*: {
e -s KEYDOWN - NUMBER: $keyval
}
on *:SIGNAL:*: {
if $signal = WMENU { goto signal.safe.esc }
e -s SIGNAL: $signal $1-
:signal.safe.esc
}
#DEBUG.EVENTS END
#DEBUG.VARIABLES off
alias set {
if - = $left($1,1) && l isin $1 {
set - $+ $replace($1,l,u5) $2-
echo $color(info) -s -
echo $color(info) -s /set $1-
echo $color(highlight) -s $2 was a local variable. While debug is on, /set -u5 is used instead.
echo $color(info) -s -
}
else {
set $1-
echo $color(info) -s * /set $1-
}
}
alias unset {
unset $1-
echo $color(info) -s * /unset $1-
}
#DEBUG.VARIABLES END
alias dbug {
if !$isid {
if $debug { debug -c off }
if !$debug { debug -n 3 $+(@dbug,.,$window($active).cid) $+($mircdir,dbug.logs\,dbug.,$window($active).cid,.txt) }
}
}
/*
Error check and callback
This is left outside of the #DEBUG grouping, because it may be implemented without the
debug mode being on, and is designed to work with\like mIRC's normal error returns.
If you design your aliases to call back success or failure, you can report that data
easily with this. Wrap the identifier $er() arround your properly designed alias, to
achieve an in-line echo of the error.
USAGE:
$er(<errorcode>,<$scriptline>,<$nopath($script)>,[other error data])
/er <errorcode> <$scriptline> <$nopath($script)> [other error data]
1
EXAMPLES:
//er $er($iif(1 = 2,OK,ERR),1,C:\stfu.test,AUGH I burted!)
Error codes need to be a single word, and must be in %er.tok for them to be caught.
Null can't yet be treated as an error code:
//er $er($iif(1 = 2,OK,$null),OK,ERROR),1,test)
//er $er(,1,test)
Interesting Note: //er $er(ERROR,1,test)
Khaled didn't block recursion where an alias is both an $alias and an /alias. :)
I have coded ahead of myself... the redundancy is intentional.
Planned Additions:
Record data to the dbug log and window.
*/
alias er {
if $istok(%er.tok,$1,92) {
if $isid {
return $1 $2 $3 $4-
}
if !$isid && $3 {
e -s $1 $+ : $4- ( $+ line $2 $+ , $3 $+ )
halt
}
}
if $isid { return $1- }
else { e -s $1- }
}
;Debugging-----END