eventOnTimer(intaiTimerID)
Description
Wiki Description
Event called once a real-time timer started on a script expires. This event will not be sent if the game is in menu mode.
Documentation Comment
Timer event, sent when a timer on this script expires. The ID of the expired timer is
passed in as the parameter. This event is sent only once for each timer that expires.
Caveats
CK Wiki - Notes
-
Aliases and quests will automatically cancel all timers when the quest stops. Active magic effects will automatically cancel all timers when they are removed.
-
This event is not relayed to any other script on the same form, or aliases or magic effects on that form.
-
The time will be affected by the global time modifier.
- For example, if global time is slowed because the player is in VATS selection or on Jet, timer events will be slowed accordingly.
- CAUTION: During VATS playback, parts of the game are slowed at different rates. Timer events do not accommodate this, and will run at the player's modified speed, even if other elements of the game (Mysterious Stranger, enemies, world animations) are moving at different modified speeds. This typically means that you will get the event sooner than you expected. It's not an issue for most scripts.
- However, if you do need to detect and react to OnTimer events differently during VATS playback, you can use Game.IsVATSPlaybackActive() to detect this state.
Parameters
intaiTimerID
CK Wiki Description
The ID number of the timer which just expired.
Examples
int myCoolTimerID = 10 ; Give our timer an ID we can remember
Function SomeFunction()
StartTimer(5, myCoolTimerID) ; Create the timer with a 5 second duration
EndFunction
Event OnTimer(int aiTimerID)
If aiTimerID == myCoolTimerID ; The five second timer we started just expired
Debug.Trace("Timer ended! Do some cool stuff now...")
; If we wanted to have the timer start over, we could now do StartTimer again...
EndIf
EndEventAuto-Generated Example
Scriptname MyCoolScript extends ScriptObject
event OnTimer(int aiTimerID)
Debug.trace("Event received - OnTimer: aiTimerID = " + aiTimerID)
endEvent