GetTime
From The Official Visionaire Studio: Adventure Game Engine Wiki
Revision as of 21:27, 30 September 2014 by Vis apiuser (talk)
getTime
Returns the number of milli seconds since the command was called the first time (or the timer was reset). Use this command for relative time measurements. E.g. call this command twice at different locations and calculate the time differential to see the time passed.
Available since: v3.0
Lua Syntax:
getTime({flags=1, reset = true|false})
Arguments
Flags
r/reset
- If true the timer will be reset and the next call(s) will return the time passed since this call.
Return Values
- time
- Milli seconds
Examples
Example 1:
-- we'll use this function to check current time elapsed & decide what action to perform
function checkTime()
if getTime() > 3000 then -- if time elapsed is more than 3 seconds then ...
-- do some action
getTime({flags=1, reset=true}) -- let's reset timer back to zero
end
end
-- the checkTime() function would be most effective if included in a mainLoop event handler