llGetAndResetTime

From Second Life Wiki
Revision as of 11:29, 24 September 2012 by Kireji Haiku (talk | contribs) (changed description of how script works)
Jump to navigation Jump to search

Summary

Function: float llGetAndResetTime( );

Returns a float that is script time in seconds and then resets the script time to zero.

Specification

Script time is the amount of time the script has been running since it first started, was most recently reset, or one of the reset functions was called. It is unaffected by time dilation.

Caveats

All Issues ~ Search JIRA for related Bugs

Examples

<lsl> default {

   state_entry()
   {
       llResetTime();
   }
   touch_start(integer num_touch)
   {
       // This is equivalent to calling llGetTime(), then llResetTime()
       float time = llGetAndResetTime();
       llSay(PUBLIC_CHANNEL, (string)time + " seconds have elapsed since the last touch or boot-up.");
   }

}

</lsl>

Notes

Script time is the amount of real-world time that the script has been in a running state. It is unaffected by time dilation, but it does not count time while the script is suspended, the user is offline (when in an attachment), the object is in inventory rather than rezzed, etc.

See Also

Functions

•  llResetTime
•  llGetTime
•  llGetRegionTimeDilation

Deep Notes

All Issues

~ Search JIRA for related Issues
   llGetTime doesn't reset on admin requested sim restart

Signature

function float llGetAndResetTime();