== Dungeon script hierarchy ==
{| class="wikitable"| The dungeon script file follows a definite structure. However, this may be hard to see since certain keywords can be used over and over again. For example to re-define default values in a certain portion of the script, the keyword <code>RoomDefault</code> might be encountered at the <code>LevelDefault</code> stage or simply the <code>Level</code> stage. Each dungeon has default parameters specified within <code>LevelDefault</code> and <code>RoomDefault</code>. This is where the general look and feel of the dungeon can be uniformly specified with only a few commands. These defaults can be overridden at any point in the script, within that dungeon. Each level is explicitly catalogued by level number. <code>LevelDefault</code> can be overridden to change the look and feel of just one particular level if desired. Rooms are described in the <code>Level</code> portion of the script, since rooms are contained on levels in the same way levels are contained in dungeons. Default specs for rooms (<code>RoomDefault</code>) can be overridden. This can either be done within each level, affecting only the specifications for rooms generated on that level, or it may be done on a per-room basis. Rooms can be rigidly specified, with special "script maps" <code>GTerrainMap</code>, <code>OTerrainMap</code>, <code>ItemMap</code> and <code>CharacterMap</code> listed, showing which types to be generated. Squares can be defined within rooms, or within a level somewhere. On a square may be placed any amount of items, or a particular ground-terrain or over-terrain, such as stairs or a fountain. Each room and square can be made to appear randomly within a level, in a random position, and/or within a random sub-area of a level (handled by <code>BoundedRandom</code>), and/or on a random member of a subset of levels (handled by <code>RandomLevel</code>). | [[File:DungeonHierarchies.png|400pxthumb|Example of hierarchy in a dungeon script]]|}
The dungeon script file follows a definite structure. However, this may be hard to see since certain keywords can be used over and over again. For example to re-define default values in a certain portion of the script, the keyword <code>RoomDefault</code> might be encountered at the <code>LevelDefault</code> stage or simply the <code>Level</code> stage.
Squares can be defined within rooms, or within a level somewhere. On a square may be placed any amount of items, or a particular ground-terrain or over-terrain, such as stairs or a fountain.
Each room and square can be made to appear randomly within a level, in a random position, and/or within a random sub-area of a level (handled by <code>BoundedRandom</code>), and/or on a random member of a subset of levels (handled by <code>RandomLevel</code>). [[File:DungeonHierarchies.png|right|400px|caption]]
== Examples from the original game ==