mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Dec 2011
Posts: 4
C
curillo Offline OP
Self-satisified door
OP Offline
Self-satisified door
C
Joined: Dec 2011
Posts: 4
I have been searching and trying for hours, but I can't make it work:

Let's say I have variables called
%test.1
%test.2
...
%test.10

Now I want to use a while loop to display them all. Something like:

var %i = 1
while (%i <= 10) {
echo 2 %test.%i
inc %i
}

The above code doesn't work. How do I make it work?

Thanks!

Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
try changing

echo 2 %test.%i

into

echo 2 %test. [ $+ [ %i ] ]

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Or:

Code:
echo 2 $($+(%,test.,%i),2)


Invision Support
#Invision on irc.irchighway.net
Joined: Dec 2011
Posts: 4
C
curillo Offline OP
Self-satisified door
OP Offline
Self-satisified door
C
Joined: Dec 2011
Posts: 4
Thanks for the replies. Unfortunately, neither of those work for me.

Joined: Dec 2011
Posts: 4
C
curillo Offline OP
Self-satisified door
OP Offline
Self-satisified door
C
Joined: Dec 2011
Posts: 4
Oh, wait... the second one works when put in an alias, but not when doing a straight /echo

Joined: Dec 2011
Posts: 4
C
curillo Offline OP
Self-satisified door
OP Offline
Self-satisified door
C
Joined: Dec 2011
Posts: 4
Never mind. I must have mistyped something. They both work in an alias.

Thanks!

Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
You need to use two slashes to evaluate identifiers in the edit box: //echo -a $pi (and of course your variable would need to be global or defined in the same command)

Last edited by Loki12583; 10/12/11 01:30 AM.

Link Copied to Clipboard