Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
prestojosh
Beginner


Joined: 21 Feb 2006
Posts: 19

PostPosted: Tue Sep 26, 2006 3:12 pm   

Looping problem maybe?
 
I have a variable.. numitems

I also have a list of variables that are as follows
1num
1name
2num
2name
3num
3name
etc

For as many different sets of variables, there is a 1 in the numitems, so for this example @numitems=3

What I need to do is be able to output something like

@1num @1name
@2num @2name
@3num @3name
and so on for as many times/numbers there is in @numitems.

Any ideas?
_________________
-Presto
Reply with quote
Guinn
Wizard


Joined: 03 Mar 2001
Posts: 1127
Location: London

PostPosted: Tue Sep 26, 2006 3:46 pm   
 
#loop @numitems {%eval( @%concat( %i, num)) %eval( @%concat( %i, name))}

should get you started. there's probably a cleaner way of writing it though, but using %i as part of a variable name requires the eval and concat
_________________
CMUD Pro, Windows Vista x64
Core2 Q6600, 4GB RAM, GeForce 8800GT
Because you need it for text... ;)
Reply with quote
Larkin
Wizard


Joined: 25 Mar 2003
Posts: 1113
Location: USA

PostPosted: Tue Sep 26, 2006 6:50 pm   
 
Actually, it doesn't require it. You can use curly braces in strange and creative ways to make this work. (Not sure if you want the #SHOW or not...)

Code:
#LOOP @numitems {#SHOW @{%{i}num} @{%{i}name}}
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net