Scripts
Home · The engine in ten minutes · Script virtual machine · The levels
In brief
Stairs, teleporters, secret walls, doors that close behind the party and conversations with the people the party meets are all driven by level scripts. Each level's INF file carries a block of script code and binds pieces of it to blocks of the map. When something happens in a bound block — the party steps in, an item is dropped or thrown into it, a wall is clicked, a timer expires — the game runs that block's script, provided the block is set to react to that kind of event. A script tests conditions, then changes the world, and runs to completion before the game continues.
Positions are written [XX:YY]: column XX and row YY, counted from 00,
for block index YY × 32 + XX.
What scripts can do
The commands are grouped by what they change; each links to its instruction page for the exact encoding.
| What changes | Commands | Page |
|---|---|---|
| Walls and doors | Set or toggle walls; open, close or toggle a door | Scripted walls and doors |
| The party, monsters, items, the level | Move, turn, change level; place or provoke a monster; create, remove, identify or drop items | Scripted movement, monsters and items |
| Characters, flags, what the player sees and hears | Damage, heal, award experience; set and clear flags; messages, dialogues, sounds, waits; launches, special events, sequences | Scripted characters, flags and messages |
The pages of this chapter
| Page | What it covers |
|---|---|
| Events that start scripts | The events, activating walls, keyboard and monster events, which events a block accepts. |
| How a script runs | A run, conditions, what they test, scripts and the game's state. |
| Scripted walls and doors | Setting and toggling walls; door requests and their timing. |
| Scripted movement, monsters and items | Moving and turning, changing level, monsters, items. |
| Scripted characters, flags and messages | Characters, flags and resting, messages and dialogue, special events. |
| Script virtual machine | The encoding of the script language and its 30 instructions. |
Sources
Locations refer to the game executable reference; comparative sources are listed in the technical references. Statements about the original levels come from decoding the scripts of the 16 reference INF files listed in the file inventory.