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
Tyjix
Newbie


Joined: 27 Mar 2005
Posts: 1

PostPosted: Sun Mar 27, 2005 3:42 am   

Loop Question
 
Okay say i have a variable called killing that equals 0 and i want my script to stop at that point and that start running again when the variable equals 1. Any suggestions on how i could do it?
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Sun Mar 27, 2005 3:38 pm   
 
You could use an #UNTIL loop to keep the loop running until killing = 0. To get you back into the loop, have a separate trigger set killing to 1 so that the next time your other trigger or whatever is fired it will jump into the loop.

The only other way to do what you want will be to simply use an infinite loop (ie, #UNTIL with a condition that never changes) that contains all your original code in an #IF check. I don't recommend this, since it will always be active and could interfere with other scripts or even just waste your memory.
_________________
EDIT: I didn't like my old signature
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5187

PostPosted: Mon Mar 28, 2005 1:50 am   
 
This would depend on what your script is and how it is built. Generally scripts either issue a command immediately to start or await some text to respond to. If your script issue a command at the start of its activities then simply issue that command at the same place that sets killing back to 1. You would also add an #IF check for killing=0 at the point, in the script, that reissues that command. For scripts that respond to a given series of text simply enclose the first response of the loop in the appropiate #IF check.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
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