Difference between revisions of "LlGetScriptState"

From Second Life Wiki
Jump to navigation Jump to search
m
(added example)
Line 9: Line 9:
|caveats
|caveats
|constants
|constants
|examples
|examples=
<lsl>
default
{
    touch_start(integer num_detected)
    {
        integer index = llGetInventoryNumber(INVENTORY_SCRIPT);
 
        // start with (total - 1) and end with 0
        while (--index)
        {
            string scriptName = llGetInventoryName(INVENTORY_SCRIPT, index);
            integer scriptState = llGetScriptState(scriptName);
 
            string output = "FALSE";
            if (scriptState) output = "TRUE";
 
            // PUBLIC_CHANNEL has the integer value 0
            llSay(PUBLIC_CHANNEL,
                "Script named '" + scriptName + "' has current script state '" + output + "'.");
        }
    }
}
</lsl>
|helpers
|helpers
|also_functions=
|also_functions=

Revision as of 06:43, 6 October 2012

Summary

Function: integer llGetScriptState( string script );

Returns an integer boolean 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

<lsl> default {

   touch_start(integer num_detected)
   {
       integer index = llGetInventoryNumber(INVENTORY_SCRIPT);
       // start with (total - 1) and end with 0
       while (--index)
       {
           string scriptName = llGetInventoryName(INVENTORY_SCRIPT, index);
           integer scriptState = llGetScriptState(scriptName);
           string output = "FALSE";
           if (scriptState) output = "TRUE";
           // PUBLIC_CHANNEL has the integer value 0
           llSay(PUBLIC_CHANNEL,
               "Script named '" + scriptName + "' has current script state '" + output + "'.");
       }
   }

}

</lsl>

See Also

Functions

•  llSetScriptState
•  llResetOtherScript

Deep Notes

History

Search JIRA for related Issues

Signature

function integer llGetScriptState( string script );