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
user0101
Apprentice


Joined: 01 Aug 2003
Posts: 100
Location: USA

PostPosted: Fri Jan 02, 2004 3:29 am   

Executing everything in a list
 
I don't have any specific examples, because this is just an idea I had and wasn't sure if it is possible. Let's say for the sake of argument that @stringlist is a string-list that contains aliases. I want everything in the string-list to be executed and deleted from the stringlist immediately after.

#forall @stringlist {%item(@stringlist, %i);#delitem stringlist %i}

amount=%numitems(@stringlist)
#LOOP @amount {%item( @stringlist, @index);#add index 1}
index=1

Both don't work.
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Fri Jan 02, 2004 5:02 am   
 
quote:

#forall @stringlist {%item(@stringlist, %i);#delitem stringlist %i}



You weren't far off on this one. #FORALL's %i is the actual element value itself (ie, if the first item in your list was 'dofighting' then %i = 'dofighting'). When you tried to use it in the %item() function, it was expanded to %item(@stringlist, dofighting), and ZMud just doesn't know what to do with that since it expects a number as the second parameter for %item().

Therefore, just use %i in place of the %item() function.
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