API:GetGameTime
From RoR Wiki
UI Lua API · Time functions
Version: WAR 1.4.8
Returns the client's running game clock, in whole seconds.
seconds = GetGameTime()
Arguments
None.
Returns
- seconds
number– Whole seconds on the client's game clock.
Details
- The value is read from the client's high-resolution frame timer, which counts from a fixed point set by the client, and is cut to whole seconds. It is not a date or a time of day; use it to measure intervals.
- Several data tables give times as game-clock values. The stock UI subtracts
GetGameTime()from them to get the seconds remaining (see the example). - Arguments are not checked; anything passed is ignored.
Errors
None.
Example
From easystem_utils/source/datautils.lua:
function DataUtils.GetPQTimerRemaining( timerState, timerValue )
if ( timerState == GameData.PQTimerState.RUNNING )
then
-- In this case, timerValue is the game time at which the timer expires
local timeLeft = timerValue - GetGameTime()
From easystem_tooltips/source/itemtooltips.lua:
currentTimeLeftBeforeDecay = currentTimeLeftBeforeDecay + itemData.timestamp - GetGameTime()
