Difference between revisions of "LlSetScriptState"

From Second Life Wiki
Jump to navigation Jump to search
(clarify what happens when a script stops itself)
Line 10: Line 10:
|spec
|spec
|caveats=*Cannot be used to restart a script that has encoutered a {{LSLGC|Error|run-time error}}.
|caveats=*Cannot be used to restart a script that has encoutered a {{LSLGC|Error|run-time error}}.
*[http://forums.secondlife.com/showthread.php?t=172251 Bug: Script inventory not found error, but script is there]
*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.
|constants
|constants
|examples=
|examples=
<pre>//Stops the Script, and Does Nothing Further until rerez, or invoked with TRUE, in another script
<pre>//Stops the Script, at some non-deterministic time later, until invoked with TRUE, in another script
llSetScriptState(llGetScriptName(),FALSE);</pre>
llSetScriptState(llGetScriptName(),FALSE);
// Stall until end of time slice
llSleep(0.1);</pre>


<pre>//Starts Another Script
<pre>//Starts Another Script

Revision as of 21:18, 26 May 2007

Summary

Function: llSetScriptState( string name, integer run );

Set the running state of the script name.

• string name a script in the inventory of the prim this script is in
• integer run boolean, 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 encoutered a run-time error.
  • 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.
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

Search JIRA for related Issues

Signature

function void llSetScriptState( string name, integer run );