FANDOM


SyntaxEdit

llGetScriptState(string name);
integer var = llGetScriptState(string name);

Checks and returns the running state of a script in the same prim, identified by the parameter name.

Parameters

string name
any string value or string variable, that contains the name of the script to be checked

Returns integer

Returns the value TRUE if the named script is running, otherwise FALSE.

Example

Checks and informs about the running state of all scripts in the same prim, when the owner says "/99 status".

default 
{
	state_entry()
	{
		llListen(99, "", llGetOwner(), "");
	}

	listen(integer channel, string name, key id, string message)
	{
		if (llToLower(message) == "status")
		{
			integer i;
			string ScriptName;
			for ( i = 0; i < llGetInventoryNumber(INVENTORY_SCRIPT); i++ )
			{
				ScriptName = llGetInventoryName(INVENTORY_SCRIPT, i);
				if (llGetScriptState(ScriptName) == TRUE) 
				{
					llOwnerSay(ScriptName + " is running. ");
				}
				else
				{
					llOwnerSay(ScriptName + " is not running. ");
				}
			}
		}
	}
}

Remarks

llGetScriptState() does the following operations in detail:

  • It looks up, if the script given in parameter name exists.
  • Does it not exist, the error could not find script is spawn and no further action is taken.
  • Does the script exist, it returns TRUE, when the script is running or FALSE, when the script is not running.

Notes

The function does return FALSE not only, when the script is not running, but also, when a script does not exist in the inventory. If it is relevant for the scripts operation, it should be checked if the returned FALSE might mean, the script does not exist.

if (llGetScriptState(ScriptName) == FALSE)
	{
		if (llGetInventoryType(ScriptName) == INVENTORY_NONE)
		{
			llOwnerSay(ScriptName + " does not exist. ");
		}
		else
		{
			llOwnerSay(ScriptName + " exists and is not running. ");
		}
	}
	else
	{
		llOwnerSay(ScriptName + " is running. ");
	}

This correctly returns FALSE, when a script isn't running because it has crashed.

There is currently no function to ask the state of a script, if it might have been crashed.

Related Functions

Related Events

  • state_entry - Is the first event raised, after a script reset

Platforms

SecondLife (agni), Secondlife (aditi), OpenSimulator

See alsoEdit


  Icon-edit-22x22 Read comments or write a new one!    

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.