OsGetHealth

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
(Created page with "Gets an avatars health by key. Example usage: default { touch(integer t) { key agentID = llDetectedKey(0); osCauseDam...")
 
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Gets an avatars health by key.
+
{{osslfunc
 +
|threat_level=None
 +
|permissions=true
 +
|delay=0
 +
|function_syntax=float osGetHealth(key 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]].
   
+
|additional_info=This function was added in 0.7.5-post-fixes
    default
+
}}
    {
+
        touch(integer t)
+
        {
+
            key agentID = llDetectedKey(0);
+
            osCauseDamage(agentID, 50);
+
            llSay(0, llKey2Name(agentID) + " has " + (string)osGetHealth(agentID) + "% health left.");
+
        }
+
    }
+

Revision as of 12:59, 14 November 2018

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

See also OsCauseDamage, OsCauseHealing.

Threat Level None
Permissions Use of this function is always allowed by default
Extra Delay 0 seconds
Example(s)
default
{
    touch(integer t)
    {
        key agentID = llDetectedKey(0);
        osCauseDamage(agentID, 50);
        llSay(0, llKey2Name(agentID) + " has " + (string)osGetHealth(agentID) + "% health left.");
    }
}
Notes
This function was added in 0.7.5-post-fixes
Personal tools
General
About This Wiki