mIRC Home    About    Download    Register    News    Help

Print Thread
reading a variable from a variable? #190049 15/11/07 01:01 PM
Joined: Aug 2005
Posts: 31
D
Div Offline OP
Ameglian cow
OP Offline
Ameglian cow
D
Joined: Aug 2005
Posts: 31
Code:
alias ttt {
  var %a = oioi
  var %b = welcome
  var %c = hello
  var %order = a b c
  echo -a check: [ % $+ $gettok(%order,1,32) ]
}


Can someone get this to work pls?
I want something like this cause for me it matters in what order %order is set to.

Thanks alot in advance!

Re: reading a variable from a variable? [Re: Div] #190050 15/11/07 01:09 PM
Joined: Jan 2003
Posts: 2,523
Q
qwerty Offline
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
echo -a check: % [ $+ [ $gettok(%order,1,32) ] ]
or
echo -a check: $eval(% $+ $gettok(%order,1,32),2)


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Re: reading a variable from a variable? [Re: qwerty] #190052 15/11/07 01:18 PM
Joined: Dec 2002
Posts: 2,016
R
RoCk Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,016

What about b and c ?

echo -a check: $eval($+(%,$replace(%order,$chr(32),$+($chr(32),%))),2)

~ Edit ~

Removed $gettok()


Re: reading a variable from a variable? [Re: RoCk] #190055 15/11/07 01:26 PM
Joined: Jan 2003
Posts: 2,523
Q
qwerty Offline
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
Div's code looks like a test case, where 1 was used instead of a counter in $gettok() (ie it looks like he just wants to know how to evaluate dynamic variables). He'll have to be more specific if he wants something else in addition.

Edit: like what you posted smile

Last edited by qwerty; 15/11/07 01:27 PM.

/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com