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


Joined: 01 Mar 2002
Posts: 3

PostPosted: Fri Mar 01, 2002 8:02 am   

How do you stop a script?
 
I assume it is probably the easiest thing in the world to do, but I can't seem to figure it out.

I have a script, which essentially has a loop. How could I manually stop the script from running?
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Fri Mar 01, 2002 8:22 am   
 
Depends on the script and on the loop used.

You can throw in many #IF checks.

Post your loop script or the skeleton of it and that would help us figure
out a good way to break out of it.

TonDiening
Beta Upgrading to 6.26
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Fri Mar 01, 2002 8:50 am   
 
Once the script is running it is very hard to stop if it was not written with a builtin kill switch. The line I use when I am testing new scripts that I think may be harzardous to my setting or may contain some bad logic is.

#IF (KillIT) {#ECHO Script killed!;#ABORT 1}

Just put that inside any loops your concerned about before starting the script.

Then you can either set yourself a button to toggle KillIT, or just set it manually in the command line, with "killit=1", when you know something is wrong.
Reply with quote
Qlute
Newbie


Joined: 01 Mar 2002
Posts: 3

PostPosted: Fri Mar 01, 2002 9:06 am   
 
The script essentially consists of.

#while {@control_variable = "TRUE"} {

}

I can stop it by modifying @control_variable, but is there any way to break out of it in the middle of the loop somewhere. I don't seem to be able to find a command like break in C or last in Perl. Also, is there any sort of brute force method of stopping the script? Like killing a process in Unix?
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Fri Mar 01, 2002 11:23 am   
 
You might be able to gain more control with the debugger open.

See help->find->scripts:
Debugging scripts
BREAK

I've never overly played with it myself.

TonDiening
Beta Upgrading to 6.26
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Fri Mar 01, 2002 1:25 pm   
 
The #ABORT command works like break in zMUD. Example:
#LOOP 1,%numrooms {#IF (%roomname(%i) = "Some Name") {#ECHO Found It!;#VAR roomnum %i;#ABORT}}

If you supply #ABORT with a 1 as an argument, it stops the whole script, not just the loop it is in. If you type #ABORT 1 in the command line, you can stop a script that has gone into an infinite loop. Also, hitting the ESC key will do the same thing.

Kjata
Reply with quote
Qlute
Newbie


Joined: 01 Mar 2002
Posts: 3

PostPosted: Fri Mar 01, 2002 6:48 pm   
 
Thanks for the help everyone. Its been very helpful.
Reply with quote
Drakmorden
Novice


Joined: 14 Dec 2000
Posts: 34
Location: USA

PostPosted: Sun Mar 10, 2002 8:44 pm   
 
Personally, when I am testing a new script, I have a macro set to do #ig (f12 for instance) so that I can stop all triggers and see what it messing up without losing the current move or case variables. After it works I set up a new class folder for the driving portion of the script and then set up hot keys to do a #t+ classfolder and a #t- classfolder. That way, if I get attacked by another player and stop the script, I can resume it after the fight right where I stopped it.

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