Events in the Arx scripting language are entry points of entity scripts. They are sent by the game engine or by other scripts using the
sendevent command. While the engine defines some event names, entity scripts can use arbitrary names for custom events.
Events sent by the game engine are usually executed synchronously although there are some exceptions. Events sent by scripts are always executed asynchronously.
Events are first executed in the entity instance script. Commands are executed after
on eventname until a
refuse command is reached.
refuse ends event execution while
accept allows execution to continue after
on eventname in the entity class script until a
refuse command is reached there. If a script does not have a
on eventname block, the event is always accepted.
For events sent by the game engine, ending the event with
refuse sometimes also determines some further engine behavior. For events send by entity scripts the result is not returned to the sender.
Events can have up to three parameters which can be accessed using the special read-only script variables as
^¶m3 or as
Mega-hidden entities can only receive the
reload event and dead NPCs can only receive the
inventory2_close events. Additionally, certain events can be disabled for an entity using the
setevent script command.
The following is a (incomplete) list of events sent by the game engine. Scripts can send arbitrarily named events.
|Sent on collisions involving an entity in the
|Sent on collisions with a field created with the Create field () spell.|
|Sent periodically when dead.|
|Sent when the the entity is damaged.|
|Sent when closing non-player inventories.|
|Sent when opening non-player inventories.|
|Sent periodically when not dead.|
|Sent when the the entity is damaged and did not receive an
|Sent when a spell is cast.|
|Sent when a spell ends or is cancelled.|
|Sent when opening or closing a non-player inventory by pickpocketing.|