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


Joined: 29 May 2002
Posts: 121

PostPosted: Sun Nov 21, 2004 3:04 am   

Looping through Stringlist
 
Anyone have any idea why this doesn't work for looping through a stringlist?

#FORALL @VContents {#VARIABLE VContents %trim( %i)}
Reply with quote
Aarlot
Adept


Joined: 30 Dec 2003
Posts: 226

PostPosted: Sun Nov 21, 2004 3:16 am   
 
Hrm... with the way you have it, the first item on the list will be written to VContents, overwriting everything else in the variable, thus only having one value to loop through.

IE: Vcontents has Blah, Blah2 and Blah3 in it. Your #FORALL goes to the first entry, Blah. It then does "#VAR VContents Blah" which makes the value of @VContents "Blah" rather than "Blah|Blah2|Blah3". Since there are now no more values in the variable to loop through, it is finished. That's the problem, I'm pretty sure (untested). You'd probably have to do something with #ADDITEM to do this and have it work.

_
_________________
Everyone is entitled to their beliefs - until they die. Then only the truth matters.
Reply with quote
Oracle
Apprentice


Joined: 29 May 2002
Posts: 121

PostPosted: Sun Nov 21, 2004 4:56 am   
 
You know that is a good point, I've also tried it with #additem and it didn't work either, in fact gave me wierd results:

#FORALL @VContents {#additems VContents_new %trim( %i)}
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Sun Nov 21, 2004 5:20 am   
 
#FORALL @VContents {#ADDITEM VContents_new {%trim("%i")}}
_________________
Zmud Support Library
Zmud Knowledge Base
Reply with quote
Theragil
Apprentice


Joined: 13 Feb 2004
Posts: 157
Location: USA

PostPosted: Sun Nov 21, 2004 5:21 am   
 
What is it you're trying to do? Changing the value of the variable you're looping over while you're looping over it doesn't make much sense without some context.
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