mIRC Home    About    Download    Register    News    Help

Print Thread
Potential variables bug evaluating $1- #259063 01/10/16 08:31 AM
Joined: Dec 2002
Posts: 230
T
Talon Offline OP
Fjord artisan
OP Offline
Fjord artisan
T
Joined: Dec 2002
Posts: 230
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


Re: Potential variables bug evaluating $1- [Re: Talon] #259064 01/10/16 08:59 AM
Joined: Apr 2004
Posts: 863
Sat Offline
Hoopy frood
Offline
Hoopy frood
Joined: Apr 2004
Posts: 863
Yes, that's why there's the -n switch for /var and /set.


Saturn, QuakeNet staff
Re: Potential variables bug evaluating $1- [Re: Sat] #259065 01/10/16 10:17 AM
Joined: Dec 2002
Posts: 230
T
Talon Offline OP
Fjord artisan
OP Offline
Fjord artisan
T
Joined: Dec 2002
Posts: 230
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-