OsGetHealth

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
m (Change See Also)
 
(9 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 
{{osslfunc
 
{{osslfunc
 
|threat_level=None
 
|threat_level=None
|function_syntax=float osGetHealth(string avatar)
+
|permissions=true
 +
|delay=0
 +
|function_syntax=float osGetHealth(key avatar)
 +
|description=Gets an avatars health by key and returns the value as a float.
 
|ossl_example=<source lang="lsl">
 
|ossl_example=<source lang="lsl">
 +
//
 +
// osGetHealth Script Example
 +
// Author: djphil
 +
//
 +
 
default
 
default
 
{
 
{
     touch(integer t)
+
    state_entry()
 +
    {
 +
        llSay(PUBLIC_CHANNEL, "Touch to see osGetHealth usage.");
 +
    }
 +
 
 +
     touch(integer number)
 
     {
 
     {
 
         key agentID = llDetectedKey(0);
 
         key agentID = llDetectedKey(0);
         osCauseDamage(agentID, 50);
+
         osCauseDamage(agentID, 50.0);
         llSay(0, llKey2Name(agentID) + " has " + (string)osGetHealth(agentID) + "% health left.");
+
         llSay(PUBLIC_CHANNEL, llKey2Name(agentID) + " has " + (string)osGetHealth(agentID) + "% health left.");
 
     }
 
     }
 
}
 
}
 
</source>
 
</source>
|description=Gets an avatars health by key and returns the value as a float.
+
|additional_info=This function was added in 0.7.5-post-fixes
 
+
See also [[OsCauseDamage]], [[OsCauseHealing]], .
+
|
+
 
}}
 
}}
 +
== See Also ==
 +
* [[osGetHealth]]
 +
* [[osSetHealth]]
 +
* [[osGetHealRate]]
 +
* [[osSetHealRate]]
 +
* [[OsCauseDamage]]
 +
* [[OsCauseHealing]]

Latest revision as of 19:47, 5 December 2020

float osGetHealth(key avatar)
Gets an avatars health by key and returns the value as a float.
Threat Level None
Permissions Use of this function is always allowed by default
Extra Delay 0 seconds
Example(s)
//
// osGetHealth Script Example
// Author: djphil
//
 
default
{
    state_entry()
    {
        llSay(PUBLIC_CHANNEL, "Touch to see osGetHealth usage.");
    }
 
    touch(integer number)
    {
        key agentID = llDetectedKey(0);
        osCauseDamage(agentID, 50.0);
        llSay(PUBLIC_CHANNEL, llKey2Name(agentID) + " has " + (string)osGetHealth(agentID) + "% health left.");
    }
}
Notes
This function was added in 0.7.5-post-fixes


[edit] See Also

Personal tools
General
About This Wiki