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
Y3KPanic
Novice


Joined: 21 Apr 2004
Posts: 34

PostPosted: Mon May 17, 2004 12:59 am   

Why Doesn't This Loop Structure Work?
 
This is a prompt-based trigger that (or is supposed to) cycle through the list of things to do, do the next thing that my character is able to (whether it be something in the string list attacks, actions, or smoking), and then delete that thing from my to do list. The problem is, when I test it, all it does is return an empty line instead of issuing the command specified in my todo list. Is there something wrong with my loop structure? I'd greatly appreciate any help.

didsomething = 0
#FORALL @todolist {
#IF (%numitems( @todolist) > 0) {
#IF (@canfight and %ismember( %i, @attacks) and !@didsomething) {
%item( @todolist, i)
#delitem todolist %item( @todolist, i)
didsomething = 1
}
#IF (@cando and %ismember( %i, @actions) and !@didsomething) {
%item( @todolist, i)
#delitem todolist %item( @todolist, i)
didsomething = 1
}
#IF (@cansmoke and %ismember( %i, @smoking) and !@didsomething) {
%item( @todolist, i)
#delitem todolist %item( @todolist, i)
didsomething = 1
}
}
}
didsomething = 0

Also, I'd like to execute the commands on my todolist in the order I put them in, if possible. I am at a loss as to where I went wrong.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Mon May 17, 2004 3:14 am   
 
Anywhere that you have %item( @todolist, i) change it to %item( @todolist, %i) and try it again.
Reply with quote
Y3KPanic
Novice


Joined: 21 Apr 2004
Posts: 34

PostPosted: Mon May 17, 2004 3:45 am   
 
Thanks. I changed it to %i, which also did the trick.
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