Block events
BlockEventMask · 16-bit word passed to the block event dispatcher
Events that start scripts · Block state flags · The engine in ten minutes
Level scripts run in response to events on a block: the party steps in, an
item is dropped, a monster arrives, a timer expires. Each event has a mask
value, which the game passes to the block's script; the script reads it back
with SCRIPT_EXPR_EVENT_MASK to know why it runs. Whether a block receives an
event at all depends on its block state flags;
see event gating.1
All ten values that the reference scripts compare with the event mask are in this list.
typedef enum BlockEventMask {
BLOCK_EVENT_PARTY_ENTER = 0x0001, /* The party has been moved into the block. */
BLOCK_EVENT_PARTY_LEAVE = 0x0002, /* The party is leaving the block. */
BLOCK_EVENT_ITEM_PLACED = 0x0004, /* An item has been put into the block, or a flight ended there. */
BLOCK_EVENT_ITEM_REMOVED = 0x0008, /* An item has been taken out of the block. */
BLOCK_EVENT_FLYING_OBJECT = 0x0010, /* A flying object entered the block or struck one of its special walls. */
BLOCK_EVENT_STEP_COUNT = 0x0020, /* The party's step counter passed the sublevel's threshold ([00:00]). */
BLOCK_EVENT_WALL_DECORATION = 0x0040, /* The player activated a wall of the block in front of the party. */
BLOCK_EVENT_TIMER = 0x0080, /* A level script timer has expired. */
BLOCK_EVENT_ITEM_USED = 0x0100, /* A character used an item; sent to the block in front of the party. */
BLOCK_EVENT_MONSTER_ENTER = 0x0200, /* A monster has been placed in the block. */
BLOCK_EVENT_MONSTER_EXIT = 0x0400, /* A monster is leaving the block. */
BLOCK_EVENT_SPELL_CAST = 0x0800, /* A spell is being started; sent to the party's block. */
BLOCK_EVENT_KEYBOARD_ACTIVATION = 0xffff /* Not an event: the gate of the keyboard wall activation, every bit set. */
} BlockEventMask;
BLOCK_EVENT_STEP_COUNT, BLOCK_EVENT_WALL_DECORATION and BLOCK_EVENT_TIMER
need no enabling bit in the block state.
Who sends each event
Positions are written [XX:YY], column then row, for block index YY × 32 + XX.
| Event | Block that receives it | Sent by |
|---|---|---|
BLOCK_EVENT_PARTY_ENTER | The party's new block | Moving the party |
BLOCK_EVENT_PARTY_LEAVE | The party's previous block | Moving the party |
BLOCK_EVENT_ITEM_PLACED | The block receiving the item | Dropping on the floor, a niche, keyboard drop and pick-up, end of a flight |
BLOCK_EVENT_ITEM_REMOVED | The block losing the item | Picking up from the floor, a niche, keyboard pick-up |
BLOCK_EVENT_FLYING_OBJECT | The block entered, or whose wall was struck | Flying-object loop; special walls through the flying-object step |
BLOCK_EVENT_STEP_COUNT | [00:00] (block index 0) | Step trigger |
BLOCK_EVENT_WALL_DECORATION | The block in front of the party | Wall-decoration click; special walls through the front-block record run |
BLOCK_EVENT_TIMER | The timer's target block | Script timers |
BLOCK_EVENT_ITEM_USED | The block in front of the party | Using an inventory item |
BLOCK_EVENT_MONSTER_ENTER | The monster's new block; [00:00] when a monster dies | Placing a monster, including a monster's death |
BLOCK_EVENT_MONSTER_EXIT | The monster's old block | Placing a monster, including a monster's death |
BLOCK_EVENT_SPELL_CAST | The party's block | Casting a spell |
The reference scripts compare the event mask with ten of these values; they
never compare it with BLOCK_EVENT_STEP_COUNT or BLOCK_EVENT_TIMER.
Wall activation from the keyboard
The lever and script-only wall handlers pass a gate value instead of a fixed
event: BLOCK_EVENT_WALL_DECORATION for a click on the wall in front,
BLOCK_EVENT_FLYING_OBJECT for a flying object, and
BLOCK_EVENT_KEYBOARD_ACTIVATION, every bit set, for the keyboard command
that activates the wall in front. A script started that way sees
BLOCK_EVENT_KEYBOARD_ACTIVATION, which equals no single event; see
activating walls.2
Sources
Locations refer to the game executable reference.