mIRC Homepage
Posted By: Talon Potential variables bug evaluating $1- - 01/10/16 08:31 AM
User requested help with a script that set a variable to $1-, did a number of operations on a variable with multiple ifs and replaces, etc.. and returned the final output of the variable. Came across a situation where if $1- was literally a simple mathematical equation it in turn was evaluated instead of just returning. To save time, here's how to reproduce what's happening.

Code demonstrating the effect:

//tokenize 32 3 + 3 | var %b = $1- | echo -a %b
or
//tokenize 32 3 + 3 | set -l %b $1- | echo -a %b

Result: 6

Posted By: Sat Re: Potential variables bug evaluating $1- - 01/10/16 08:59 AM
Yes, that's why there's the -n switch for /var and /set.
Posted By: Talon Re: Potential variables bug evaluating $1- - 01/10/16 10:17 AM
hmm, didn't try that, apparently it works, I figured by definition anything passed would be treated as plaintext and %b would literally be $1-
© mIRC Discussion Forums