Background for Skyrim SE
Member of the Form script
voidfunctionRegisterForSingleUpdate(floatafInterval)Native

Description

Wiki Description

Registers this form/alias/magic effect for a single Form.OnUpdate(). Which also means you don't need to call Form.UnregisterForUpdate() unless you want to cancel the update early. Only the specific form, alias, or magic effect that registered will get the event - it will not be relayed to attached aliases or magic effects.

Documentation Comment

Register for a single OnUpdate event, in afInterval seconds. All scripts attached to this form will get the update events
Of course, this means you don't need to call UnregisterForUpdate()
If you find yourself doing this:
Event OnUpdate()
UnregisterForUpdate()
{Do some stuff}
endEvent
Then you should use RegisterForSingleUpdate instead


Caveats

CK Wiki - Notes

  • Aliases and quests will automatically unregister for this event when the quest stops. Active magic effects will automatically unregister when they are removed.
  • You should call Form.UnregisterForUpdate() before calling this function a second time prior to the timer elapsing or before calling Form.RegisterForUpdate(...), or strange behavior may result. Testing suggests that calling RegisterForUpdate after RegisterForSingleUpdate will replace the single update's timer interval with the one provided in the call to RegisterForUpdate and will not start a periodic timer. It also suggests that subsequent calls to RegisterForSingleUpdate without an intervening UnregisterForUpdate do not behave as expected, if the timer hasn't elapsed.

Parameters

  1. floatafInterval

    CK Wiki Description

    In how much time (in seconds, ignoring menu-mode time) the Form.OnUpdate() should be triggered


Examples

; Register for a single update in 30.0 seconds - does not count menu-mode time.
RegisterForSingleUpdate(30.0)

Auto-Generated Example

float myFloat__afInterval

myForm__toCallFunctionOn.RegisterForSingleUpdate(myFloat__afInterval)

Related Pages


Additional References

View this function’s page on the Skyrim Creation Kit Wiki

Some data provided by the Skyrim Creation Kit Wiki. Licensed under the Creative Commons Attribution-ShareAlike license.