llSetScriptState
void llSetScriptState(string ScriptName, integer Running)Enable or disable the script Running state of Script in the prim.
Parameters
-
ScriptName(string) -
Running(integer)
Stop the script at the end of the current time slice, until re-enabled:
//Stops the Script, at some non-deterministic time later, until invoked with TRUE, in another scriptllSetScriptState(llGetScriptName(), FALSE);// Stall until end of time slicellSleep(0.1);Start another script:
//Starts Another ScriptllSetScriptState("somescript", TRUE);Caveats
Section titled “Caveats”- Cannot be used to restart a script that has encountered a runtime error.
- Cannot be used to start a script that has been added via
llGiveInventory. Scripts sent viallRemoteLoadScriptPin, and which have the running state set FALSE by that command, may be started. - The script appears to stop when its time slice ends, not sooner. If a script tries to stop itself then some LSL code following the
llSetScriptStatecall may be executed before the script stops. - If a script is paused by
llSetScriptStateand is then either re-rezzed, in a region during a restart, or moved into a different region, the script’s memory is reset.