Difference between revisions of "LlSetScriptState"

From Second Life Wiki
Jump to navigation Jump to search
(Undo revision 80936 by Ralph Doctorow (Talk))
Line 11: Line 11:
|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}}.
*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.
*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.
*This function has a major problem if a script needs to keep any state information. If the server is reset, or the object taken into inventory and re-rezzed and possibly when crossing a sim boundary, all state information for all inactive scripts is lost. As of 25/07/2008 according to Scouse Linden the server reset bug will not be fixed.
|constants
|constants
|examples=
|examples=
<lsl>
<lsl>//Stops the Script, at some non-deterministic time later, until invoked with TRUE, in another script
//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);
llSleep(0.1);</lsl>
</lsl>
<lsl>//Starts Another Script
<lsl>
llSetScriptState("somescript",TRUE);</lsl>
//Starts Another Script
llSetScriptState("somescript",TRUE);
</lsl>
|helpers
|helpers
|also_functions=
|also_functions=
Line 32: Line 27:
|also_articles
|also_articles
|notes
|notes
|sort=SetScriptState
|issues=
{{Bug|SVC-1853|Script state is not saved when the script has been deactivated with [[llSetScriptState]].}}
|cat1=Script
|cat1=Script
|cat2
|cat2

Revision as of 01:08, 30 July 2008

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

<lsl>//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);</lsl> <lsl>//Starts Another Script

llSetScriptState("somescript",TRUE);</lsl>

See Also

Functions

•  llGetScriptState
•  llResetOtherScript

Deep Notes

Search JIRA for related Issues

Signature

function void llSetScriptState( string name, integer run );