OsGetHealRate

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
{{osslfunc
 
{{osslfunc
 
|threat_level=None
 
|threat_level=None
 +
|permissions=true
 +
|delay=0
 
|function_syntax=float osGetHealRate(key avatar)
 
|function_syntax=float osGetHealRate(key avatar)
 
|ossl_example=<source lang="lsl">
 
|ossl_example=<source lang="lsl">
key uuid;
+
//
 +
// osGetHealth Script Example
 +
//
  
 
default
 
default
Line 9: Line 13:
 
     state_entry()
 
     state_entry()
 
     {
 
     {
         llSay(PUBLIC_CHANNEL, "Script running");
+
         key uuid = llGetOwner();
    }
+
         osSetHealRate(uuid, 10.0);
 
+
         osCauseDamage(uuid, 50.0);
    touch_start(integer number)
+
         llOwnerSay("osGetHealRate = " + (string)osGetHealRate(uuid));
    {
+
         llOwnerSay(llKey2Name(uuid) + " has " + (string)osGetHealth(uuid) + "% health left.");
        uuid = llDetectedKey(0);
+
         llOwnerSay("osGetHealRate Before = " + (string)osGetHealRate(uuid));
+
         osSetHealRate(uuid, llFrand(1.0));
+
         llOwnerSay("osGetHealRate After = " + (string)osGetHealRate(uuid));
+
         llSetTimerEvent(5.0);
+
    }
+
 
+
    timer()
+
    {
+
        llSetTimerEvent(0.0);
+
        osSetHealRate(uuid, 0.5);
+
        llOwnerSay("osGetHealRate Default = " + (string)osGetHealRate(uuid));
+
 
     }
 
     }
 
}
 
}
 
</source>
 
</source>
|description=Gets an avatars health rate by key and returns the value as a float.
+
|description=Gets the current automatic healing rate in % per second.
  
 
Default heal rate is now around 0.5% per second.<br />
 
Default heal rate is now around 0.5% per second.<br />
 
A value of zero can disable automatic heal, current maximum value is 100 % per second.<br />
 
A value of zero can disable automatic heal, current maximum value is 100 % per second.<br />
  
See also [[OsSetHealRate]], [[OsGetHealth]], [[OsCauseDamage]], [[OsCauseHealing]].
+
See also [[OsSetHealRate]].
|
+
|additional_info=This function was added in 0.9.0.1}}
}}
+

Revision as of 09:59, 7 December 2018

float osGetHealRate(key avatar)
Gets the current automatic healing rate in % per second.

Default heal rate is now around 0.5% per second.
A value of zero can disable automatic heal, current maximum value is 100 % per second.

See also OsSetHealRate.

Threat Level None
Permissions Use of this function is always allowed by default
Extra Delay 0 seconds
Example(s)
//
// osGetHealth Script Example
//
 
default
{
    state_entry()
    {
        key uuid = llGetOwner();
        osSetHealRate(uuid, 10.0);
        osCauseDamage(uuid, 50.0);
        llOwnerSay("osGetHealRate = " + (string)osGetHealRate(uuid));
        llOwnerSay(llKey2Name(uuid) + " has " + (string)osGetHealth(uuid) + "% health left.");
    }
}
Notes
This function was added in 0.9.0.1
Personal tools
General
About This Wiki