SetOnAuxTimerUpdateHandler

From GECK
Jump to: navigation, search


A function added by the ShowOff NVSE Plugin version 1.65.

Description

Sets/removes the specified UDF Script as a handler that will be invoked when a specified Auxiliary Timer owned by a specified form is updated. This happens every frame that it is running.

NOTE: this event will only run if the AuxTimer has the Run OnTimerUpdate Event flag enabled; see AuxTimerStart.

Handlers will be removed when the game is loaded or sent to the Main Menu.

If no form is specified, will assume PlayerRef as the AuxTimer owner.

When invoked, the script is passed with three arguments: the AuxTimer string name, the owner form, and the time passed since the last update (float).

  • The time passed will always be 1 for frame-based timers, otherwise it will be a delta in seconds.

Syntax

[help]
ownerRefr.SetOnAuxTimerUpdateHandler setORremove:1/0 handlerScript:ref timerName:string ownerForm:ref 

Or:

ownerRefr.SetOnTimerUpdateHandler setORremove:1/0 handlerScript:ref timerName:string ownerForm:ref 

Example Handler

begin Function { string_var sTimerName, ref rOwnerForm, float fTimeDelta }

        print "OnAuxTimerUpdate>> RAN!"
        printvar sTimerName, rOwnerForm
        printvar fTimeDelta 

        ;* ASSUMES rOwnerForm is a reference!!!!
        float fTimeLeft = rOwnerForm.AuxTimerTimeLeft $sTimerName
        float fTimeElapsed = rOwnerForm.AuxTimerTimeElapsed $sTimerName
        printvar fTimeLeft, fTimeElapsed 

end

See Also