Difference between revisions of "LlGetAndResetTime"

From Second Life Wiki
Jump to navigation Jump to search
(*guess* it's affected by SVC-3293 as well)
m
Line 8: Line 8:
|return_text=that is script time in seconds and then resets the script time to zero.
|return_text=that is script time in seconds and then resets the script time to zero.
|func_footnote
|func_footnote
|spec=Script time differs from normal time, it is affected by time dilation. See [[llGetRegionTimeDilation]] for details.
|spec=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=
|caveats=
*Script time resets when...
*Script time resets when...
**Script reset (user or [[llResetScript]] or [[llResetOtherScript]])
**Script reset (user or [[llResetScript]] or [[llResetOtherScript]])
**Simulator reset (admin or crash)
**Call to either [[llResetTime]] or [[llGetAndResetTime]]
**Call to either [[llResetTime]] or [[llGetAndResetTime]]
*Script time doesn't measure real world time, it is affected by time dilation.
|examples=<lsl>
|examples=<lsl>
default {
default {
Line 33: Line 31:
{{LSL DefineRow||[[llGetRegionTimeDilation]]}}
{{LSL DefineRow||[[llGetRegionTimeDilation]]}}
|also
|also
|notes=Script time does not measure time dilation.
|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 set to not running.
To measure elapsed calendar time, call [[llGetTimestamp]] instead, since time dilation and resets often make dilated time intervals differ from calendar time intervals.
|cat1=Time
|cat1=Time
|cat2=Script
|cat2=Script

Revision as of 18:26, 14 April 2010

Summary

Function: float llGetAndResetTime( );
0.0 Forced Delay
10.0 Energy

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

Examples

<lsl> default {

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

}

</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 set to not running.

See Also

Functions

•  llResetTime
•  llGetTime
•  llGetRegionTimeDilation

Deep Notes

Signature

function float llGetAndResetTime();