OsGetHealth

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
Line 1: Line 1:
Gets an avatars health by key and returns the value as a float.
+
{{osslfunc
 +
|threat_level=None
 +
|function_syntax=float osGetHealth(string avatar)
 +
|ossl_example=<source lang="lsl">
 +
default
 +
{
 +
    touch(integer t)
 +
    {
 +
        key agentID = llDetectedKey(0);
 +
        osCauseDamage(agentID, 50);
 +
        llSay(0, llKey2Name(agentID) + " has " + (string)osGetHealth(agentID) + "% health left.");
 +
    }
 +
}
 +
</source>
 +
|description=Gets an avatars health by key and returns the value as a float.
  
Example usage:
+
See also [[OsCauseDamage]], [[OsCauseHealing]], .
   
+
|
    default
+
}}
    {
+
        touch(integer t)
+
        {
+
            key agentID = llDetectedKey(0);
+
            osCauseDamage(agentID, 50);
+
            llSay(0, llKey2Name(agentID) + " has " + (string)osGetHealth(agentID) + "% health left.");
+
        }
+
    }
+

Revision as of 02:37, 24 August 2012

float osGetHealth(string avatar)
Gets an avatars health by key and returns the value as a float.

See also OsCauseDamage, OsCauseHealing, .

Threat Level None
Permissions No permissions specified
Extra Delay No function delay specified
Example(s)
default
{
    touch(integer t)
    {
        key agentID = llDetectedKey(0);
        osCauseDamage(agentID, 50);
        llSay(0, llKey2Name(agentID) + " has " + (string)osGetHealth(agentID) + "% health left.");
    }
}
Personal tools
General
About This Wiki