Difference between revisions of "LlSetScriptState"

From Second Life Wiki
Jump to navigation Jump to search
m
m (Replaced old <LSL> block with <source lang="lsl2">)
 
Line 15: Line 15:
|constants
|constants
|examples=
|examples=
<lsl>//Stops the Script, at some non-deterministic time later, until invoked with TRUE, in another script
<source lang="lsl2">//Stops the Script, at some non-deterministic time later, until invoked with TRUE, in another script
llSetScriptState(llGetScriptName(),FALSE);
llSetScriptState(llGetScriptName(),FALSE);
// Stall until end of time slice
// Stall until end of time slice
llSleep(0.1);</lsl>
llSleep(0.1);</source>
<lsl>//Starts Another Script
<source lang="lsl2">//Starts Another Script
llSetScriptState("somescript",TRUE);</lsl>
llSetScriptState("somescript",TRUE);</source>
|helpers
|helpers
|also_functions=
|also_functions=

Latest revision as of 14:07, 22 January 2015

Summary

Function: llSetScriptState( string name, integer running );

Set the running state of the script name.

• string name a script in the inventory of the prim this script is in
• integer running boolean, if TRUE[1] the script will be enabled, if FALSE the script will be disabled

Caveats

  • If name is missing from the prim's inventory or it is not a script then an error is shouted on DEBUG_CHANNEL.
  • 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 via llRemoteLoadScriptPin, 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 llSetScriptState call may be executed before the script stops.
  • If a script is paused by llSetScriptState and is then either re-rezzed, in a region during a restart, or moved into a different region, the script's memory is reset.
All Issues ~ Search JIRA for related Bugs

Examples

//Stops the Script, at some non-deterministic time later, until invoked with TRUE, in another script
llSetScriptState(llGetScriptName(),FALSE);
// Stall until end of time slice
llSleep(0.1);
//Starts Another Script
llSetScriptState("somescript",TRUE);

See Also

Functions

•  llGetScriptState
•  llResetOtherScript

Deep Notes

All Issues

~ Search JIRA for related Issues
   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.

Footnotes

  1. ^ Any value that is not zero/FALSE is treated the same as TRUE. This behavior should not be depended upon.

Signature

function void llSetScriptState( string name, integer running );