DM4 Contents

# Contents

Introduction

### Chapter I: The Inform Language

§1 Routines

- 1.1. Getting started
- 1.2. Hello World
- 1.3. Routine calls, errors and warnings
- 1.4. Numbers and other constants
- 1.5. Variables
- 1.6. Arithmetic, assignment and bitwise operators
- 1.7. Arguments and return values
- 1.8. Conditions: `if`, `true` and `false`
- 1.9. Code blocks, `else` and `switch`
- 1.10. `while`, `do`… `until`, `for`, `break`, `continue`
- 1.11. How text is printed
- 1.12. The `print` and `print_ret` statements
- 1.13. Other printing statements
- 1.14. Generating random numbers
- 1.15. Deprecated ways to jump around

§2 The state of play

- 2.1. Directives construct things
- 2.2. Constants
- 2.3. Global variables
- 2.4. Arrays
- 2.5. Reading into arrays from the keyboard

§3 Objects

- 3.1. Objects, classes, metaclasses and `nothing`
- 3.2. The object tree
- 3.3. Declaring objects 1: setting up the object tree
- 3.4. Tree statements: `move`, `remove`, `objectloop`
- 3.5. Declaring objects 2: `with` and `provides`
- 3.6. Declaring objects 3: `private` properties
- 3.7. Declaring objects 4: `has` and `give`
- 3.8. Declaring objects 5: `class` inheritance
- 3.9. Messages
- 3.10. Passing messages up to the superclass
- 3.11. Creating and deleting objects during play
- 3.12. Sending messages to routines and strings
- 3.13. Common properties and `Property`
- 3.14. Philosophy

### Chapter II: Introduction to Designing

§4 ‘Ruins’ begun

Beginning to lay ‘Ruins’; including library files; the `Initialise` routine; some properties of mushrooms; `name`, `description` and `initial`; `edible` foodstuffs; introducing `before` and `after` rules; the stone steps.

§5 Introducing messages and classes

Recap of message-sending: a parrot; classes for treasure artifacts: the pygmy statuette, the honeycomb; how clashes are sorted out in class inheritance, additivity.

§6 Actions and reactions

Actions are attempts; generating them with `<`, `<<`; the `actor`, `action`, `noun` and `second` noun; the `##` notation; actions fall into three groups; fake actions like `ThrownAt`; creating new actions, the `Blorple` example; how actions are processed, over ‘Before’, ‘During’ and ‘After’ stages.

§7 Infix and the debugging verbs

Three levels; general strategies; command lists and “recording”, “replay” and “random” debugging verbs; “showobj”, “tree”, “showverb”, “scope”; keeping watch of “actions”, “changes”, “messages”, “timers”; tracing the parser with “trace”; supernatural ability to “purloin”, “abstract”, “goto”, “gonear”; the Infix “; ”, “;give”, “;move”, “;remove”, “;examine”, “;watch”, “;inventory”; marking routines with a * to be watched.

### Chapter III: The Model World

§8 Places and scenery

The Square Chamber of ‘Ruins’; what “you don't need to refer to”; `static` and `scenery` objects; spreading mist with `found_in`; α Canis Minoris; the five senses and reaction rules; rooms have `before` and `after` too.

§9 Directions and the map

Giving ‘Ruins’ a small map; `n_to`, `d_to`, etc.; when you `cant_go`; direction objects in the `compass`; not the same as direction properties.

§10 Food and drink

`edible` foodstuffs; the `Drink` action; difficulties with liquids.

§11 Clothing

`Wear` and `Disrobe`; `wearable` items of clothing; a jade face mask.

§12 Containers, supporters and sub-objects

Containers: `container`, `supporter`, `capacity`, `open`, `openable`; locks and keys: `locked`, `lockable`, `with_key`; `LetGo` and `Receive` to trap use of a container: a chasm; transparency and component parts.

§13 Doors

How to create a `door`; `door_to`, `door_dir`; `when_open`, `when_closed`; a stone door for ‘Ruins’; a two-way door, the ‘Advent’ grate; why `door_dir` is needed and how to trap every attempt to go through.

§14 Switchable objects

`switchable` and `on`: `when_on`, `when_off`; the Gotham City searchlight; a sodium lamp; `describe` taking precedence.

§15 Things to enter, travel in and push around

`enterable` objects: a slab altar; vehicles: KAR 1; special rule about the `Go` action when inside something `enterable`; the `PushDir` action: a huge pumice-stone ball; pushing up and down.

§16 Reading matter and consultation

The `Consult` action, “look up”; `consult_from` and `consult_words`: a dictionary of glyphs, Tyndale's Bible; making “read” and “examine” different.

§17 People and animals

`animate` objects and the `life` rule; a coiled snake and a mummified priest; Blofeld's reactions; `talkable` objects; some people are `transparent`.

§18 Making conversation

Orders are actions for other people; giving people their own grammars; untypeable verbs; several voice-activated machines; fake fake actions; telephony.

§19 The light and the dark

Light versus darkness is automatic; modifying the darkness; going from dark into dark and the `DarkToDark` entry point; rules on ‘when there is light’.

§20 Daemons and the passing of time

Daemons and the `daemon` property; starting and stopping them; background daemons; timers (fuses); `time_left` and `time_out`; `each_turn` events for places and nearby objects; the time of day; changing it with `SetTime`; on the status line; midnight, sunrise, sunset; the exact sequence of events at end-of-turn.

§21 Starting, moving, changing and killing the player

What `Initialise` should do; the `location`; `initial` restoration; teleportation and the `PlayerTo` routine; what happens when the room changes: `NewRoom`, `initial` for a room, `visited`; giving the player his own `before` rule; using `ChangePlayer` to transform him into any object; multi-character games; `life` and `deadflag`; the `DeathMessage` routine; resurrection and the `AfterLife`.

§22 Miscellaneous constants, scoring, quotations

`Story` and `Headline`; `MAX_CARRIED`; the automatic “sack object”; ‘amusing’ rewards for the victorious; two scoring systems: for places and items, or for completing tasks; rankings and `PrintRank`; automatic score notification and `notify_mode`; “objects” and “places” verbs, removable with `NO_PLACES`; boxed quotations.

§23 ‘Ruins’ revisited

Further examples to complete ‘Ruins’; a map and a step by step solution of the final game.

§24 The world model described

¶1. Substance – ¶2. Containment – ¶3. Space – ¶4. Sense – ¶5. Time – ¶6. Action.

§25 Extending and redefining the world model

Enriching the model; Egyptian amulets and their spells; making a new library file; the `LibraryMessages` system for changing messages like “Dropped.”; changing the prompt; the last resort of `Replace` directives; using the world model description; fire and flammability.

### Chapter IV: Describing and Parsing

§26 Describing objects and rooms

`print (The) obj, ... (the) obj` and so on; indefinite and definite `article`; `proper` nouns; the `short_name` of an object; `invent` strings and routines; exactly how inventory lines are printed; a matchbook; `describe` routines; exactly how rooms are described; `Locale`.

§27 Listing and grouping objects

The list-maker `WriteListFrom`; its style bitmap; examples: tall and wide inventories; grouping similar items together in lists: foodstuffs, Scrabble pieces and denominations of coin.

§28 How nouns are parsed

How `name` is used; a fried green tomato turning red; the parser breaks text into a stream of words; `wn` and `NextWord`; reading words as numbers or from their raw text; a `parse_name` routine is much more flexible than `name`; the `ParseNoun` entry point; distinguishing adjectives from nouns.

§29 Plural names for duplicated objects

Collections of indistinguishable objects; a bag of six coins; the `plural` property for printing out plurals; definition of ‘indistinguishable’; writing `parse_name` routines to allow plurals to be understood; class of crowns.

§30 How verbs are parsed

The parser's fundamental method; `BeforeParsing` entry point; the actor and verb word; synonyms for verbs; definitions of grammar, line and token; `action_to_be`; `Verb` directive: a simplified “take” grammar; `meta` verbs; grammar creates actions; creating an “xyzzy” verb; how to `Extend` grammar for an existing verb: pushing numbered buttons; priority: `replace`, `first`, `last`; splitting synonymous verbs apart with `Extend only`; the `UnknownVerb` and `PrintVerb` entry points.

§31 Tokens of grammar

Full list of grammar tokens; prepositions; `noun` and `held`; implicit taking; tokens allowing multiple objects like “all”; filtering out nouns by attribute: “use” verb; and by general routine: “free” verb; parsing numbers: “type” verb, `ParseNumber`; general parsing routines; reading from the parser's raw text `buffer` and `parse` table; exercises, including French, telephone and floating-point numbers, times of day, adding a `third` parameter to a grammar line.

§32 Scope and what you can see

The definition of ‘in scope’; touchability is stricter than scope; answering questions: “what is a grue”; `scope=...` tokens with programmable scope; `scope_stage`, `ScopeWithin` and `PlaceInScope`; changing the global definition of ‘in scope’ using `InScope`; `scope_reason`; looping over and testing scope; making the rules more sensitive to darkness; a long room divided by a glass wall; the `add_to_scope` property for component parts of containers.

§33 Helping the parser out of trouble

Parser error messages and `ParserError`; ambiguity-resolution and influencing it with `ChooseObjects`; making “eat” prefer `edible` objects; redefining “all”; exactly how ambiguities are resolved.

### Chapter V: Natural Language

§34 Linguistics and the Inform parser

¡Bienvenido a Aventura!; Informese; commands, verb phrases, prepositions, noun phrases, gender-number-animation (GNA), descriptors, nouns, pronouns; example of parsing; grammatical features not present in Informese.

§35 Case and parsing noun phrases

Flexion and cases; parsing inflected noun phrases; for example, Old English dative word-endings.

§36 Parsing non-English languages

Compromises; accented characters at the keyboard?; dialects; language definition files; `Zcharacter` and the customisation of ZSCII; specifying pronouns and descriptors; translating natural languages to Informese.

§37 Names and messages in non-English languages

Gender-number-animation of short names; agreement with articles and cases; contraction forms and articles; library messages of all kinds.

### Chapter VI: Using the Compiler

§38 Controlling compilation from within

`Include`; conditional compilation: `If...`, `Ifnot`, `Endif`; `Message`; linking in the library; writing new modules to link in; serial and release numbers.

§39 Controlling compilation from without

Switches; memory settings; pathname variables; Inform Control Language (ICL).

§40 All the Inform error messages

Fatal errors; errors, including linker and assembler errors; warnings, including obsolete usage warnings.

### Chapter VII: The Z-Machine

§41 Architecture and assembly

ZIL, Inform and the Z-machine; its Versions; assembly language; store and branch opcodes, labels; memory map and stack.

§42 Devices and opcodes

The Standard for interpreters; input and output streams; the Version 5 and Version 6 screen models; colours, windows and status lines; interrupt countdowns; pictures; sounds; keyboard reading with timed interrupts; terminating characters; the mouse; menus; loading and saving auxiliary files; throwing and catching stack frames.

§43 Pictures, sounds, blurbs and Blorb

What a Blorb file is; the perlBlorb utility program; blurb files; palette, resolution, scaling; specifying what sounds and pictures belong to a story file.

§44 Case study: a library file for menus

Invisiclues; basic design; the `Option` class; the `Menu` class; the `SwitchOption` class.

§45 Limitations and getting around them

Story file size; readable memory size; grammar; vocabulary; dictionary resolution; objects, attributes, properties, names; function and message arguments; recursion and stack usage; abbreviations in text.

### Chapter VIII: The Craft of Adventure

§46 A brief history of interactive fiction

- §46.1. Precursors and university games 1972–81
- §46.2. The commercial boom 1982–6
- §46.3. The growth of a community c. 1985–91
- §46.4. Newsgroups and revival 1992–

§47 Realities and origins

Fictional backgrounds; crimes against mimesis; historical research; book adaptations.

§48 A triangle of identities

Player, protagonist and narrator; participatory magic; the overture and other narrated text.

§49 Structure

Size and density; the prologue, middle game and end game; wide versus narrow; lattice diagrams, including one for ‘Ruins’.

§50 The design of puzzles

General remarks on good and bad puzzles; mazes, light sources, capacity and exhaustion, timed puzzles, utility objects, keys and doors, machinery and vehicles, fire, water, air, earth, plants, animals, monsters, people, ropes and chains, riddles, decipherment puzzles; clues, luck and accidental solutions; optional and multiple solutions; rewards.

§51 The room description

Examples of good, mediocre and poor description; how much space is one location?; variable descriptions; outdoor games; differing perspectives.

§52 Finishing

Scoring systems; responding to wrong guesses; examples of typical bugs; play-testing and editing; concluding homily.

APPENDICES

- §A1 Library attributes
- §A2 Library properties
- §A3 Library routines
- §A4 Library message numbers
- §A5 Entry point routines
- §A6 Answers to all the exercises

TABLES

- Table 1 Operators
- Table 2 The ZSCII Character Set
- Table 3 Command Line Switches
- Table 4 Statements
- Table 5 Directives
- Table 6 Library actions

INDEX

- Cited Works of Interactive Fiction
- Index of Exercises
- General Index

Colophon
Long Descriptions of Selected Images
Back Cover