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
Winger
Beginner


Joined: 23 May 2004
Posts: 14

PostPosted: Tue Jun 08, 2004 6:01 am   

Continuing a loop on a trigger
 
Perhaps I'm too tired to get my brain to work correctly, but I'm trying to find a way to do a certain thing. I'll explain it as best I can, sorry if I don't make it too clear.

Alright, I want to start with an alias that starts a FORALL loop that does something like this:
#FORALL @DronusClass/pocketbelts {
p %i
#WAIT 200
}
Thing is, I don't want it to continue the loop until it gets one of two lines, either A)
^The pocketbelt is made out of brown canvas and

Or line B)
^What do you wish to examine?

At the same time, I want two different actions to occur depending upon which line is recieved, -before- the loop continues.

For instance, if I recieve the first line, to just keep moving. If I recieve the second line, remove the current item from "DronusClass/pocketbelts"

Is this possible? If so, please let me know how. If not, yell and scream at me about being stupid or something.
Reply with quote
Cbisazza
Wanderer


Joined: 27 Feb 2003
Posts: 69
Location: Australia

PostPosted: Tue Jun 08, 2004 6:48 am   
 
You don't want to use #WAIT. Read the support section for the reasons.

What I think you want to do is to go through the list manually (depending on the MUD output), In this case you can't use #FORALL. Instead you need to access the list item by item and manually increment a pointer variable to keep track of the current item.

If you're lost, just say so and I'll create an example.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Tue Jun 08, 2004 5:16 pm   
 
This looks like a good place for a temporary variable.
#CLASS PBloop disable
#TR {^The pocketbelt is made out of brown canvas and} {#DELN PBtemp 1;#IF %numitems( @PBtemp) {probe %item( @PBtemp, 1)} {#T- PBloop;#SAY End of list.;#UNVAR PBtemp}}
#TR {^What do you wish to examine?} {#DELI DronusClass/pocketbelts %item( @PBtemp, 1);#DELN PBtemp 1;#IF %numitems( @PBtemp) {probe %item( @PBTemp, 1)} {#T- PBloop;#SAY End of list.;#UNVAR PBtemp}}
#CLASS 0
#AL PBcheck {#T+ DronusClass;#T+ PBloop;#VAR PBtemp {@DronusClass/pocketbelts};#IF %numitems( @PBtemp) {probe %item( @PBtemp, 1)} {#T- PBloop;#SAY Nothing in list.;#UNVAR PBtemp}}
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