Don't click here unless you want to be banned.

LSL Wiki : llSetScriptState

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings :: You are
llSetScriptState(string name, integer run)

Controls the script name in the inventory of the prim that calls this function. Setting run to TRUE enables that script; FALSE disables it.

This function allows toggling the "Running" checkbox of a script in the same prim. Note that this has nothing to do with states in LSL.

NOTE: This function can also be called to disable the script it is in, however, the next line or two will be executed after the call, unless llSleep is used.

// Stops 'ScriptName' (in the prim's inventory)
llSetScriptState("ScriptName", FALSE);

// Start 'ScriptName' (in the prim's inventory)
llSetScriptState("ScriptName", TRUE);

While this function can be used to stop any script, it can only be used to start scripts which were stopped by an llSetScriptState function call. The following two cases are the primary reasons why a script cannot be started with this function:

Also see llGetScriptState.

This article wasn't helpful for you? Maybe the related article at the LSL Portal is able to bring enlightenment.

Functions | Inventory | Script | State
Comments [Hide comments/form]
This seems to be bugged if you do this in a complex object on_rez/attachment. I'm getting occasional errors that the script can't be found despite the name being correct and it working the other 90% of the time, seemingly if you trigger this in the time it takes for the objects inventory to load it can fail.
-- EataKitty (2006-07-13 08:25:35)
If LL updated this function to work in a multi-prim object, it would be quite handy to disable scripts in the non-root prims to save server resources...
-- StryfeLowell (2006-08-29 08:25:18)
Other people please test this, but it appears that when a script calls this function on itself, the call immediately following it will be executed before it takes effect.
-- (2007-08-03 01:00:06)
this function seems to be buggy if you switch 2 scripts on/off dependend which linkedmessage it receives. condition call within link_message-event seems so that it doen´t stop on next condition. it runs through next condition although it doesn´t get a linkedmessage which met the condition. seems to me that it searches 1st condition met and runs all code behind that condition. quite annoying...:(
-- (2007-10-31 09:27:31)
Attach a comment to this page: