mIRC Home    About    Download    Register    News    Help

Print Thread
Question using $'s #153557 18/07/06 09:55 PM
Joined: Jul 2006
Posts: 2
T
tezaren Offline OP
Bowl of petunias
OP Offline
Bowl of petunias
T
Joined: Jul 2006
Posts: 2
My queston is: how can I get the below code to work, displaying the actual tokens (say $1-20 in this example) instead of the actual text "$1", "$2", etc. For some reason it is not evaluating the way I am intending.

var %i = 1
tokenize 32 $1-

while (%i < 20) {
echo 3 -a $ $+ %i
inc %i ; next tok
}

Re: Question using $'s #153558 18/07/06 10:08 PM
Joined: Dec 2002
Posts: 2,962
S
starbucks_mafia Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
You need to evaluate the identifier an extra time using $eval().

Code:
var %i = 1
tokenize 32 $1-

while (%i &lt; 20) {
echo 3 -a $eval($ $+ %i, 2)
; next tok
inc %i
}


$eval($ $+ %i, 2) means it will evaluate $ $+ %i twice. Once to get $4 (for example), and then again to get the value of $4


Spelling mistakes, grammatical errors, and stupid comments are intentional.
Re: Question using $'s #153559 18/07/06 10:23 PM
Joined: Jul 2006
Posts: 2
T
tezaren Offline OP
Bowl of petunias
OP Offline
Bowl of petunias
T
Joined: Jul 2006
Posts: 2
That is exactly what I was looking for. Cheers! smile

Re: Question using $'s #153560 19/07/06 02:29 AM
Joined: Apr 2004
Posts: 218
P
PhantasyX Offline
Fjord artisan
Offline
Fjord artisan
P
Joined: Apr 2004
Posts: 218
Also, if you're interested you can use $<n>-<2> (eg. $1-20 or $4-6, etc.)
It will display <n> thru <n2>.


Live to Dream & Dream for Life