Difference between revisions of "DCS func getAbsTime"

From DCS World Wiki - Hoggitworld.com
m (1 revision imported)
 
 
(One intermediate revision by the same user not shown)
Line 13: Line 13:
 
|par4=
 
|par4=
  
|desc= Returns the mission time in seconds. It is relative compared to the mission start time.  
+
|desc= Returns the game world time in seconds relative to time the mission started. Will always count up from when the mission started. If the value is above 86400 then it is the next day after the mission started. This function is useful in attaining the time of day.  
  
The default mission start time in the mission editor is Day 1: 12:00:00. In seconds this value is: 43200
+
Assuming a mission started at noon the value returned would be 43200. (12*60*60). Midnight would be 0.  Calling this function at 12:00:10 timer.getAbsTime will return 43210.xxx.
  
 
|rtnType= time
 
|rtnType= time
Line 41: Line 41:
 
|examples= The following example would execute code 20 seconds after the mission has started.
 
|examples= The following example would execute code 20 seconds after the mission has started.
  
   if timer.getAbsTime() + env.mission.start_time > 20 then
+
   if timer.getAbsTime() + 20 > env.mission.start_time then
 
     doWhatever()
 
     doWhatever()
 
   end
 
   end
Line 48: Line 48:
 
}}
 
}}
 
[[Category:Singleton Functions|getAbsTime]]
 
[[Category:Singleton Functions|getAbsTime]]
 +
[[Category:Game Patch 1.2.0|getAbsTime]]

Latest revision as of 10:39, 8 September 2022

Scripting Root

Envrioment: Mission Scripting
Function: getAbsTime Added with: 1.2.0
Member Of: timer
Syntax: time timer.getAbsTime( )
Description: Returns the game world time in seconds relative to time the mission started. Will always count up from when the mission started. If the value is above 86400 then it is the next day after the mission started. This function is useful in attaining the time of day.

Assuming a mission started at noon the value returned would be 43200. (12*60*60). Midnight would be 0. Calling this function at 12:00:10 timer.getAbsTime will return 43210.xxx.


Return Value: time
Return Example: none
Examples: The following example would execute code 20 seconds after the mission has started.
 if timer.getAbsTime() + 20 > env.mission.start_time then
   doWhatever()
 end
Related Functions: timerfunctions: getTime, getAbsTime,getTime0, scheduleFunction, removeFunction, setFunctionTime
Notes: