1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-27 21:35:24 +00:00

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

30 lines
963 B
ReStructuredText
Raw Normal View History

2022-01-23 20:49:42 +01:00
Built-in events
===============
2023-07-09 08:42:09 +02:00
Actor events
------------
2022-01-23 20:49:42 +01:00
Any script can send to any actor (except player, for player will be ignored) events ``StartAIPackage`` and ``RemoveAIPackages``.
The effect is equivalent to calling ``interfaces.AI.startPackage`` or ``interfaces.AI.removePackages`` in a local script on this actor.
Examples:
.. code-block:: Lua
actor:sendEvent('StartAIPackage', {type='Combat', target=self.object})
actor:sendEvent('RemoveAIPackages', 'Pursue')
2023-07-09 08:42:09 +02:00
UI events
---------
Every time UI mode is changed built-in scripts send to player the event ``UiModeChanged`` with arguments ``oldMode, ``newMode`` (same as ``I.UI.getMode()``)
2023-07-09 08:42:09 +02:00
and ``arg`` (for example in the mode ``Book`` the argument is the book the player is reading).
.. code-block:: Lua
eventHandlers = {
UiModeChanged = function(data)
print('UiModeChanged from', data.oldMode , 'to', data.newMode, '('..tostring(data.arg)..')')
2023-07-09 08:42:09 +02:00
end
}