function
Function syntax
llSetScriptState(string script,// Name of the script in the prim's inventory.integer running// Boolean. IfTRUE, enables the script; ifFALSE, disables it.
);- Energy
- 10
Sets the running state of the named script in the prim's inventory. If running is TRUE, the script is enabled; if FALSE, it is disabled.
Set the running state of the script name.
llSetScriptState("", 0);Caveats
Section titled “Caveats”- Cannot be used to restart a script that has encountered a run-time error.
- Cannot be used to start a script that has been added via
llGiveInventory. Scripts sent viallRemoteLoadScriptPin, and which have the running state setFALSEby 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.
Examples
Section titled “Examples”Example 1
//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);Example 2
//Starts Another ScriptllSetScriptState("somescript",TRUE);Known issues
Section titled “Known issues”From the issue templates included by the wiki article:
- SVC-1853 (bug): Scripts deactivated by llSetScriptState are reset when the region is reset, when they are taken into inventory and re-rezzed and when crossing sim boundaries.
See also
Section titled “See also”Functions
Section titled “Functions”Original wiki source
Some wiki templates and tables need their original context. View this article on the Second Life Wiki. Technical wording and examples are retained from the source; historical guidance may differ from current behavior.