
Muscl3r
Joined: May 22, 2010
dont pray 4 easy lives...pray to be STRONGER MEN
|
Posted: Feb 12, 2012 04:13 AM
Msg. 1 of 4
Is there a command to sleep a continuous script and wake when needed?
I dont mean (begin command. Is the command (global boolean continuous_script_name flase) ?
Thanks
|
|
|

rerout343
Joined: Aug 7, 2010
Targeted and Firing
|
Posted: Feb 12, 2012 04:54 AM
Msg. 2 of 4
Best way I've found is to use a global.
First you create a global for you script to reference.(This is entered before the scripts)
(global short "name" 0)
Replace "name" with whatever you want, just make sure it's not the same as any scripts or objects in your scenario.
Now I am assuming you want to turn your script on with another script. So I'll give an example of a continuous script being turned on by someone walking into a trigger volume.
(global short trigger_a 0)
(script continuous watch_trigger (if (= (volume_test_objects my_trigger_vol (players)) 1) (set trigger_a 1) ) )
(script continuous wait_for_it (sleep_until (= trigger_a 1) 1) (whatever your script is supposed to do) )
Now the script "watch trigger" is not needed, I just typed it to show how I turned the other one on in this case. And if you would ever want to turn the script off, just use the "set" command to change the value of your global to something other than what the "sleep_until" command is waiting for. Edited by rerout343 on Feb 12, 2012 at 04:56 AM
|
|
|

TM_updates
Joined: Aug 31, 2011
Superior to you, Superior Musclez near Brussels
|
Posted: Feb 12, 2012 05:12 AM
Msg. 3 of 4
Protip @l28's script, while it is correct, it might be handy to know that instead of typing the full: " (if (= startLoop true)"
You can simply type "(if startLoop" on that particular line.
Just so you guys know :) Saves a few seconds of typing!
|
|
|

rerout343
Joined: Aug 7, 2010
Targeted and Firing
|
Posted: Feb 12, 2012 05:13 AM
Msg. 4 of 4
Quote: --- Original message by: l283023(global boolean startLoop false)
(script startup waitForCondition (sleep_until (= expression true) 15) (set startLoop true) )
(script continuous doSomething (if (= startLoop true) (begin ... ) ) ) Yeah ^ this. A lot more clear and easier to read than mine.
|
|
|