×
Меню
Индекс

MSFD Timer

Keeping track of time
 
There are a number of possibilities to follow the passage of time in scripts, including some that are not, or only poorly documented in the help file.
Timer
[no fix] GetSecondsPassed     (returns float)
 
A simple timer can be scripted with the GetSecondsPassed function. It returns the seconds passed since the last frame as a float value. To use this for a timer use something like the following example:
Begin TimerScript
 
Float timer
Short state
 
Set timer to (timer + GetSecondsPassed)
 
If (timer > 10)
     MessageBox "Displayed every 10 seconds"
     Set timer to 0
Endif
 
End TimerScript
 
[no fix] GetCurrentTime (returns float)
This returns the ingame time (24 hour) to two decimal places. This is exactly the same as using the global GameHour variable, but slightly less accurate.