Simple eval script
Posted by B1NG3
Saturday, July 24, 2004
Description: Simple eval script
This is a simple eval script with error handling and use of [] so a function is not called twice. What makes this better than most eval scripts is the use of $error for error handling, lots of commenting and the lack of use of the $eval function.
What makes this better:
Standard eval scripts using $eval($1-,2) tend to call a funtion twice.
eg. $findfile($logdir,*#script*,1,echo -a $$read($1-,w,*#script*)) will show:
while my script using [ [ $1- ] ] will show:
This is a simple eval script with error handling and use of [] so a function is not called twice. What makes this better than most eval scripts is the use of $error for error handling, lots of commenting and the lack of use of the $eval function.
alias e {
if ([ [ $$1- ] ]) say $1- == $ifmatch
else say $1- == $!null
return
;if an error occurs lets catch it :)
:error
var %retval = $error
;remove the () via $regsub so our output is sexy
if ($regsub(%retval,\(.+\),$null,%retval)) %retval = $right(%retval,-2)
else %retval = $right($error,-2)
;output the error
say $1- == %retval
;comment reseterror if you want mIRC to show the error locally with more info
reseterror
}What makes this better:
Standard eval scripts using $eval($1-,2) tend to call a funtion twice.
eg. $findfile($logdir,*#script*,1,echo -a $$read($1-,w,*#script*)) will show:
(oldtimestamp) <binge> #script r teh kewlies
(oldtimestamp) <binge> #script r teh kewlies
(newtimestamp) <+binge> $findfile($logdir,*#script*,1,echo -a $$read($1-,w,*#script*)) == #script.GameSurge.NETwhile my script using [ [ $1- ] ] will show:
(oldtimestamp) <binge> #script r teh kewlies
(newtimestamp) <+binge> $findfile($logdir,*#script*,1,echo -a $$read($1-,w,*#script*)) == #script.GameSurge.NET