Skip to main content

Script interpreter routines

Routines · Data · Address index

The block event dispatcher, the opcode handlers and the helpers they call. The routines page explains how the entries are written.

0x27aa9 — Block event dispatcher​

Opcode handlers​

The table lists the handler of each script instruction, as read from the opcode handler table. A located handler does not mean that every path through it has been examined: Partial in the coverage column means that only selected paths were examined; for the other handlers, the control flow was followed. Each instruction's page describes its encoding and effects.

ByteHandlerInstructionCoverageUsed by
0xff0x25a15–0x25ae3SCRIPT_SETAssignment targets, Scripted walls and doors › Walls, Set walls or a direction › Behavior, Script virtual machine › How a run starts, Set walls or a direction › Edge cases, Decoding status and unexpected values › Unexpected values
0xfe0x25ae4–0x25c67SCRIPT_TOGGLEScripted walls and doors › Doors, Scripted walls and doors › Walls, Toggle targets, Toggle walls or a door › Behavior, Script virtual machine › How a run starts, Toggle walls or a door › Edge cases, Decoding status and unexpected values › Unexpected values
0xfd0x25c68–0x25c9eSCRIPT_OPEN_DOOROpen a door › Behavior, Scripted walls and doors › Doors
0xfc0x25c9f–0x25cd5SCRIPT_CLOSE_DOORClose a door › Behavior, Scripted walls and doors › Doors
0xfb0x25cd6–0x25da1SCRIPT_SPAWN_MONSTERPlace a monster › When nothing happens, Scripted movement, monsters and items › Monsters
0xfa0x25ead–0x2618e; the item-move loop 0x26033–0x260e9 restarts the search 0x1cf67 from the chain head after each unlink 0x1ce9f and insert 0x1cdb4, so with source and destination the same block of the current level it never ends (ANOMALY-145)SCRIPT_MOVE_PARTY_OR_OBJECTLevel markers in move instructions, Move instruction targets, Move the party, monsters or items › Item locations, Move the party, monsters or items › Moving items, Move the party, monsters or items › Moving monsters, Scripted movement, monsters and items › Moving the party, monsters and items, Control flow, Decoding status and unexpected values › Unexpected values, Move the party, monsters or items, Monsters in the view › Drawing a monster
0xf90x2618f–0x262d1; start slot rolled 1–27 at 0x2621e and read at 0x2624f, one past the 27 inventory words (ANOMALY-84); no defense recomputation in the whole range (ANOMALY-85)SCRIPT_MOVE_INVENTORY_ITEM_TO_BLOCKCharacter selector for item transfers, Move an inventory item to a block › Behavior, Scripted movement, monsters and items › Items, Values passed on to other routines › The routines
0xf80x262d2–0x263a7; the operand replaces the text colour at 0x262fb–0x262ff, a palette colour number that the display driver writes as the pixel, and the old colour comes back at 0x26385–0x26388; unbounded member search 0x26324–0x2633b (ANOMALY-82)SCRIPT_PRINT_MESSAGECharacter eligibility tests › Masks used by scripts, Level 4: reference tables › Reading this page, Print a message › Behavior, Script virtual machine › Where scripts live, Scripted characters, flags and messages › Messages, dialogue, sound and timing, Print a message, Decoding status and unexpected values › Unexpected values
0xf70x263a8–0x26497SCRIPT_SET_FLAGSFlag operation targets, Global script flags, Monster state flags › Provoked monsters, Scripted characters, flags and messages › Flags and resting, Scripted movement, monsters and items › Monsters, Set a flag › Behavior, Set a flag › Edge cases and unknowns, Decoding status and unexpected values › Unexpected values, Values passed on to other routines › The routines
0xf60x26498–0x264edSCRIPT_PLAY_SOUNDPlay a sound › Behavior, Scripted characters, flags and messages › Messages, dialogue, sound and timing
0xf50x264ee–0x26592SCRIPT_CLEAR_FLAGSClear a flag › Encoding, Flag operation targets, Global script flags, Scripted characters, flags and messages › Flags and resting, Clear a flag › Edge cases and unknowns, Decoding status and unexpected values › Unexpected values
0xf40x26593–0x265f4SCRIPT_MODIFY_CHARACTER_HPChange hit points › Behavior, Character target for hit points and damage, Scripted characters, flags and messages › Characters
0xf30x265f5–0x266b5SCRIPT_DAMAGE_CHARACTERSCharacter target for hit points and damage, Damage characters › Behavior, Damage flags › What scripts can set, Scripted characters, flags and messages › Characters
0xf20x266b6–0x266e9SCRIPT_JUMPJump › Behavior, Control flow
0xf10x266ea–0x266feSCRIPT_ENDEnd the script › Behavior, Control flow
0xf00x266ff–0x26747SCRIPT_RETURNReturn from a call › Behavior, Control flow, Return from a call › Edge cases and unknowns
0xef0x26748–0x267a6SCRIPT_CALLCall a subroutine › Behavior, Control flow
0xee0x267a7–0x2710fSCRIPT_JUMP_UNLESSCharacter class masks, Character eligibility tests › Masks used by scripts, Condition expression tokens, Item properties in conditions, How a script runs › A run, Test a condition › Behavior, Test a condition › The expression stack
0xed0x271c5–0x27235; the held item is freed at 0x1cd1a before its holder is cleared through the placement check (0x1cd28, cursed-hand refusal 0x1d7e8–0x1d843, ANOMALY-132); no flight-table check in 0x1d0a6–0x1d1b0 (ANOMALY-133)SCRIPT_DELETE_ITEMDelete items › Behavior, Item removal targets, Scripted movement, monsters and items › Items
0xec0x27236–0x27368SCRIPT_LOAD_LEVEL_OR_MONSTERSScriptLoadTarget, The world, Scripts
0xeb0x27369–0x273acSCRIPT_AWARD_EXPERIENCEAward experience › Behavior, Experience award target, Scripted characters, flags and messages › Characters, Decoding status and unexpected values › Unexpected values
0xea0x273ad–0x27500; overrides written at 0x2740a, 0x27426, 0x27442 before the index test at 0x27449; the mouse word tested at 0x27455SCRIPT_CREATE_ITEMCreate an item, Create an item › Behavior, Item creation destinations, Item creation overrides, Item entry › Block chains, Scripted movement, monsters and items › Items
0xe90x25da2–0x25eac; the block operand is read at 0x25ddc and passed on without a check (ANOMALY-153); magic path: 0x2166a called at 0x25e8e with DS:0xe4c6 saved, cleared and restored around it; item path: copy 0x25e08, launch 0x25e44, free on failure 0x25e59; positions from DS:0x5a9dSCRIPT_LAUNCH_OBJECTLaunch an object › Behavior, Launched object kinds, Scripted characters, flags and messages › Special events and sequences, On the floor and in the air
0xe80x27501–0x27597SCRIPT_CHANGE_DIRECTIONDirection change targets, Scripted movement, monsters and items › Moving the party, monsters and items, Turn the party or flying objects › Behavior, Decoding status and unexpected values › Unexpected values
0xe70x27598–0x27658SCRIPT_IDENTIFY_ITEMSIdentify items › Behavior, Item state flags, Level block › Layout, Scripted movement, monsters and items › Items
0xe60x276ab–0x276ddSCRIPT_RUN_SEQUENCERun a sequence › Behavior, Scripted sequences, Scripted characters, flags and messages › Special events and sequences
0xe50x27659–0x276aaSCRIPT_DELAYScripted characters, flags and messages › Messages, dialogue, sound and timing, Wait › Behavior
0xe40x276de–0x276f8SCRIPT_DRAW_SCENERedraw the scene › Behavior, Scripted characters, flags and messages › Messages, dialogue, sound and timing
0xe30x276f9–0x2786fSCRIPT_DIALOGUEDialogue commands, Dialogue screen › Asking for a choice, Dialogue screen › Encoding, Scripted characters, flags and messages › Messages, dialogue, sound and timing
0xe20x27870–0x27a9aSCRIPT_SPECIAL_EVENTItem types › Where it is used, Level 5: the temple entrance, Run a special event › Behavior, Run a special event › Level gain (event 2), Run a special event › Remove two quest items (event 5), Scripted characters, flags and messages › Special events and sequences, Special events, Decoding status and unexpected values › Unexpected values

0x27236 — Load a level or monster resources​

0x27174 — Count monsters for a condition​