docs/source/reference/lua-scripting/engine_handlers.rst
.. include:: version.rst
Engine handler is a function defined by a script, that can be called by the engine.
Can be defined by any script
|bdg-ctx-all|
.. list-table:: :widths: 20 80
base) of another script.Can be defined by any non-menu script
|bdg-ctx-global| |bdg-ctx-local|
.. list-table:: :widths: 20 80
InitData can be
| assigned to a script in openmw-cs (not yet implemented).
| onInterfaceOverride can be called before onInit.dt is
| the simulation time from the last update in seconds.openmw.nearby.onSave. During loading the object is always inactive. initData is
| the same as in onInit.
| Note that onLoad means loading a script rather than loading a game.
| If a script did not exist when a game was saved onLoad will not be
| called, but onInit will.Only for global scripts
|bdg-ctx-global|
.. list-table:: :widths: 20 80
Game object.
| Note that this is triggered at the start of a game, and when a game is loaded.Only for local scripts
|bdg-ctx-local|
.. list-table:: :widths: 20 80
Only menu scripts and local scripts attached to a player
|bdg-ctx-menu| |bdg-ctx-player|
.. list-table:: :widths: 20 80
dt is simulation time delta (0 when on pause).Key <openmw_input.html##(KeyboardEvent)>_ is pressed.
| Usage example:
| if key.symbol == 'z' and key.withShift then ...Key <openmw_input.html##(KeyboardEvent)>_ is released.
| Usage example:
| if key.symbol == 'z' and key.withShift then ...button <openmw_input.html##(CONTROLLER_BUTTON)>_ on a game controller is pressed.
| Usage example:
| if id == input.CONTROLLER_BUTTON.LeftStick then ...button <openmw_input.html##(CONTROLLER_BUTTON)>_ on a game controller is released.
| Usage example:
| if id == input.CONTROLLER_BUTTON.LeftStick then ...registerActionHandler <openmw_input.html##(registerActionHandler)>)
| Game control <openmw_input.html##(ACTION)> is pressed.
| Usage example:
| if id == input.ACTION.ToggleWeapon then ...Touch event <openmw_input.html##(TouchEvent)>_.Touch event <openmw_input.html##(TouchEvent)>_.Touch event <openmw_input.html##(TouchEvent)>_.command in in-game console. Called if either
| mode is not default or command starts with prefix lua.Only for local scripts attached to a player
|bdg-ctx-player|
.. list-table:: :widths: 20 80
Key <openmw_input.html##(KeyboardEvent)>_ is pressed.
| Usage example:
| if key.symbol == 'z' and key.withShift then ...Only for menu scripts
|bdg-ctx-menu|
.. list-table:: :widths: 20 80
getState <openmw_menu.html##(menu).getState>_ changes)Only for load scripts
|bdg-ctx-load|
.. list-table:: :widths: 20 80