LlGetScriptState - Second Life Wiki

LlGetScriptState

From Second Life Wiki

Jump to: navigation, search

Contents

Summary

Function: integer llGetScriptState( string script );

Returns a boolean (an integer) that is TRUE if the script is running.

• string script a script in the inventory of the prim this script is in

Caveats

  • If script is missing from the prim's inventory or it is not a script then an error is shouted on DEBUG_CHANNEL.
All Issues ~ Search JIRA for related Bugs

Examples

default
{
    touch_start(integer num_detected)
    {
        integer numberOfScripts = llGetInventoryNumber(INVENTORY_SCRIPT);
 
        integer index;
        do
        {
            string scriptName = llGetInventoryName(INVENTORY_SCRIPT, index);
            integer scriptState = llGetScriptState(scriptName);
 
        //  default value
            string output = "FALSE";
        //  else
            if (scriptState) output = "TRUE";
 
            // PUBLIC_CHANNEL has the integer value 0
            llSay(PUBLIC_CHANNEL,
                "Script named '" + scriptName + "' has current script state '" + output + "'.");
        }
        while (++index < numberOfScripts);
    }
}

See Also

Functions

•  llSetScriptState
•  llResetOtherScript

Deep Notes

History

  • There was a time when llGetScriptState would return TRUE even if the script had encountered a run-time error. This is no longer the case.

Search JIRA for related Issues

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