Home
About
Download
Register
News
Help
Register
Log In
Forums
Scripts & Popups
Displaying variables in a while loop
Forums
Active Threads
Search
Who's Online
Help
Print Thread
Displaying variables in a while loop
#
235329
09/12/11
03:32 PM
Joined:
Dec 2011
Posts: 4
C
curillo
OP
Self-satisified door
OP
curillo
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!
Copy Link to Clipboard
Re: Displaying variables in a while loop
curillo
#
235332
09/12/11
04:44 PM
Joined:
Jan 2004
Posts: 2,127
maroon
Hoopy frood
maroon
Hoopy frood
Joined:
Jan 2004
Posts: 2,127
try changing
echo 2 %test.%i
into
echo 2 %test. [ $+ [ %i ] ]
Copy Link to Clipboard
Re: Displaying variables in a while loop
maroon
#
235337
09/12/11
09:08 PM
Joined:
Oct 2004
Posts: 8,330
MA, USA
Riamus2
Hoopy frood
Riamus2
Hoopy frood
Joined:
Oct 2004
Posts: 8,330
MA, USA
Or:
Code:
echo 2 $($+(%,test.,%i),2)
Invision Support
#Invision on irc.irchighway.net
Copy Link to Clipboard
Re: Displaying variables in a while loop
Riamus2
#
235340
09/12/11
11:14 PM
Joined:
Dec 2011
Posts: 4
C
curillo
OP
Self-satisified door
OP
curillo
Self-satisified door
C
Joined:
Dec 2011
Posts: 4
Thanks for the replies. Unfortunately, neither of those work for me.
Copy Link to Clipboard
Re: Displaying variables in a while loop
curillo
#
235341
09/12/11
11:19 PM
Joined:
Dec 2011
Posts: 4
C
curillo
OP
Self-satisified door
OP
curillo
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
Copy Link to Clipboard
Re: Displaying variables in a while loop
curillo
#
235342
09/12/11
11:20 PM
Joined:
Dec 2011
Posts: 4
C
curillo
OP
Self-satisified door
OP
curillo
Self-satisified door
C
Joined:
Dec 2011
Posts: 4
Never mind. I must have mistyped something. They both work in an alias.
Thanks!
Copy Link to Clipboard
Re: Displaying variables in a while loop
curillo
#
235343
10/12/11
01:29 AM
Joined:
Jan 2004
Posts: 1,358
L
Loki12583
Hoopy frood
Loki12583
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
.
Copy Link to Clipboard
Hop To
News and Discussions ------
Latest News
General Discussion
Support ------
mIRC Help
Connection Issues
Scripts & Popups
Development ------
Feature Suggestions
Developers
Bug Reports
Print Thread
Switch to Threaded Mode
Show Likes
Link Copied to Clipboard
View Profile
Private Message
Follow User
Forum Posts
View Profile
Private Message
Follow User
Forum Posts
View Profile
Private Message
Website
Follow User
Forum Posts
View Profile
Private Message
Follow User
Forum Posts
View Profile
Private Message
Follow User
Forum Posts
View Profile
Private Message
Follow User
Forum Posts
View Profile
Private Message
Follow User
Forum Posts
Forum Rules
·
Mark All Read
Contact Us
·
Help
·
mIRC Homepage