Difference between revisions of "GetCurrentGameTime - Utility"
Jump to navigation
Jump to search
Tag: Reverted |
Tag: Reverted |
||
Line 23: | Line 23: | ||
You must use a rounding function to cast the returned value to an exact integer i.e. | You must use a rounding function to cast the returned value to an exact integer i.e. | ||
( (an integer) day == Math.Floor(Utility.GetCurrentGameTime()) ) | ( (an integer value ) day == Math.Floor(Utility.GetCurrentGameTime()) ) | ||
or maybe | or maybe | ||
( (an integer) day == Math.Ceil(Utility.GetCurrentGameTime()) ) | ( (an integer value ) day == Math.Ceil(Utility.GetCurrentGameTime()) ) | ||
== Examples == | == Examples == |
Revision as of 04:35, 13 September 2024
Member of: Utility Script
Obtains the current game time in terms of game days passed (same as the global variable)
Syntax
float Function GetCurrentGameTime() native
Parameters
None.
Return Value
The current game time in terms of "game days passed".
Return Value
No it DOES NOT return QUITE what it is supposed to.
It returns a fractional value, NOT an EXACT Integer. The comparison operators "<" and ">" will work but "==" WILL FAIL most of the time. You must use a rounding function to cast the returned value to an exact integer i.e.
( (an integer value ) day == Math.Floor(Utility.GetCurrentGameTime()) )
or maybe
( (an integer value ) day == Math.Ceil(Utility.GetCurrentGameTime()) )
Examples
; What is the current in-game time?
Debug.Trace("The current time is: " + Utility.GetCurrentGameTime() + " in game days passed")