Ar HasKey
A function added by the Oblivion Script Extender.
Syntax:
(hasKey:bool) ar_HasKey src:array key:arrayKey
Returns true if the array has an element with the specified key.
This function can also be used to detect a new game load (after a restart, or loading from a save), in a way that avoids some of the limitations of GetGameRestarted, GetGameLoaded, and OnLoad blocks. The first two of these only return true for the first invocation of each from a particular script, regardless of how many base objects and references use that script. The OnLoad block may not execute if the player starts up the game and immediately loads a save from the same cell as the object.
Code like the following can be used to work around this, exploiting the otherwise-inconvenient fact that OBSE arrays are not persistent across game loads:
Array_var initFlagArray Begin GameMode if Ar_HasKey initFlagArray, 0 ; Initialization has been completed. else ; Need to initialize. Start by clearing the condition. let initFlagArray := Ar_construct Array let initFlagArray[0] := 0 ; Value does not matter as long as it exists endif ... End