Examples in Thematic Order

Preface

1
* Example  About the examples
An explanation of the examples in this documentation, and the asterisks attached to them. Click the heading of the example, or the example number, to reveal the text.

WI
11
* Example  Midsummer Day
A few sentences laying out a garden together with some things which might be found in it.

WI


Disenchantment Bay

13
* Example  Disenchantment Bay 1
A running example in this chapter, Disenchantment Bay, involves chartering a boat. This is the first step: creating the cabin.

WI
15
* Example  Disenchantment Bay 2
Disenchantment Bay: creating some of the objects in the cabin's description.

WI
16
* Example  Disenchantment Bay 3
Disenchantment Bay: adding a view of the glacier.

WI
17
* Example  Disenchantment Bay 4
Disenchantment Bay: fleshing out the descriptions of things on the boat.

WI
19
* Example  Disenchantment Bay 5
Disenchantment Bay: adding the door and the deck to our charter boat.

WI
22
* Example  Disenchantment Bay 6
Disenchantment Bay: locking up the charter boat's fishing rods.

WI
24
* Example  Disenchantment Bay 7
Disenchantment Bay: making the radar and instruments switch on and off.

WI
27
** Example  Disenchantment Bay 8
Disenchantment Bay: a pushable chest of ice for the boat.

WI
29
* Example  Disenchantment Bay 9
Disenchantment Bay: enter the charter boat's Captain.

WI
32
* Example  Disenchantment Bay 10
Disenchantment Bay: things for the player and the characters to wear and carry.

WI
33
* Example  Disenchantment Bay 11
Disenchantment Bay: making a holdall of the backpack.

WI
35
**** Example  Disenchantment Bay 12
A final trip to Disenchantment Bay: the scenario turned into a somewhat fuller scene, with various features that have not yet been explained.

WI


Information Only

370
*** Example  Backus-Naur form for rules
The full grammar Inform uses to parse rule definitions, in a standard computer-science notation.

WI
219
*** Example  Formal syntax of sentences
A more formal description of the sentence grammar used by Inform for both assertions and conditions.

WI
236
*** Example  Mathematical view of relations
Some notes on relations from a mathematical point of view, provided only to clarify some technicalities for those who are interested.

WI
237
*** Example  Graph-theory view of relations
Some notes on relations from the point of view of graph theory.

WI
390
* Example  About Inform's regular expression support
Some footnotes on Inform's regular expressions, and how they compare to those of other programming languages.

WI


Varying What Is Written

175
* Example  M. Melmoth's Duel
Three basic ways to inject random or not-so-random variations into text.

WI
165
* Example  Ahem
Writing a phrase, with several variant forms, whose function is to follow a rule several times.

WI
68
* Example  Fifty Ways to Leave Your Larva
Using text substitution to make characters reply differently under the same circumstances.

WI
69
*** Example  Fifty Times Fifty Ways
Writing your own rules for how to carry out substitutions.

WI
173
* Example  Curare
A phrase that chooses and names the least-recently selected item from the collection given, allowing the text to cycle semi-randomly through a group of objects.

WI
286
*** Example  Straw Into Gold
Creating a Rumpelstiltskin character who is always referred to as "dwarf", "guy", "dude", or "man" -- depending on which the player last used -- until the first time the player refers to him as "Rumpelstiltskin".

WI
424
* Example  Odins
Making [is-are] and [it-they] say tokens that will choose appropriately based on the last object mentioned.

WI
58
*** Example  Ballpark
A new "to say" definition which allows the author to say "[a number in round numbers]" and get verbal descriptions like "a couple of" or "a few" as a result.

WI
170
* Example  Numberless
A simple exercise in printing the names of random numbers, comparing the use of "otherwise if...", a switch statement, or a table-based alternative.

WI
319
* Example  Prolegomena
Replacing precise numbers with "some" or other quantifiers when too many objects are clustered together for the player to count at a glance.

WI
428
* Example  Blink
Making a "by atmosphere" token, allowing us to design our own text variations such as "[one of]normal[or]gloomy[or]scary[by atmosphere]".

WI
397
* Example  Blackout
Filtering the names of rooms printed while in darkness.

WI
388
* Example  Rocket Man
Using case changes on any text produced by a "to say..." phrase.

WI


Varying What Is Read

18
** Example  Laura
Some general advice about creating objects with unusual or awkward names, and a discussion of the use of printed names.

WI
41
** Example  Vouvray
Adding synonyms to an entire kind of thing.

WI
10
* Example  First Name Basis
Allowing the player to use different synonyms to refer to something.

WI
303
* Example  Quiz Show
In this example by Mike Tarbert, the player can occasionally be quizzed on random data from a table; the potential answers will only be understood if a question has just been asked.

WI
350
** Example  North by Northwest
Creating additional compass directions between those that already exist (for instance, NNW) -- and dealing with an awkwardness that arises when the player tries to type "north-northwest". The example demonstrates a way around the nine-character limit on parsed words.

WI


Using the Player's Input

297
*** Example  Terracottissima Maxima
Flowerpots with textual names that might change during play.

WI
398
** Example  Mr. Burns' Repast
Letting the player guess types for an unidentifiable fish.

WI
356
*** Example  Xot
Storing an invalid command to be repeated as text later in the game.

WI
396
* Example  Igpay Atinlay
A pig Latin filter for the player's commands.

WI


Map

4
* Example  Port Royal 1
A partial implementation of Port Royal, Jamaica, set before the earthquake of 1692 demolished large portions of the city.

WI
7
* Example  Port Royal 2
Another part of Port Royal, with less typical map connections.

WI
9
* Example  Port Royal 3
Division of Port Royal into regions.

WI
99
** Example  A&E
Using regions to block access to an entire area when the player does not carry a pass, regardless of which entrance he uses.

WI
123
* Example  Bee Chambers
A maze with directions between rooms randomized at the start of play.

WI
131
* Example  Zork II
A "Carousel Room", as in Zork II, where moving in any direction from the room leads (at random) to one of the eight rooms nearby.

WI
38
** Example  Prisoner's Dilemma
A button that causes a previously non-existent exit to come into being.

WI
75
* Example  All Roads Lead to Mars
Layout where the player is allowed to wander any direction he likes, and the map will arrange itself in order so that he finds the correct "next" location.

WI


Position Within Rooms

61
* Example  When?
A door whose description says "...leads east" in one place and "...leads west" in the other.

WI
63
*** Example  Whence?
A kind of door that always automatically describes the direction it opens and what lies on the far side (if that other room has been visited).

WI


Continuous Spaces and The Outdoors

125
* Example  Higher Calling
All doors in the game automatically attempt to open if the player approaches them when they are closed.

WI
147
** Example  Elsie
A door that closes automatically one turn after the player opens it.

WI
23
** Example  Neighborhood Watch
A locked door that can be locked or unlocked without a key from one side, but not from the other.

WI
21
*** Example  Garibaldi 1
Providing a security readout device by which the player can check on the status of all doors in the game.

WI
43
* Example  Something Narsty
A staircase always open and never openable.

WI
85
* Example  Hayseed
A refinement of our staircase kind which can be climbed.

WI
104
** Example  One Short Plank
A plank bridge which breaks if the player is carrying something when he goes across it. Pushing anything over the bridge is forbidden outright.

WI
6
*** Example  Starry Void
Creating a booth that can be seen from the outside, opened and closed, and entered as a separate room.

WI


Doors, Staircases, and Bridges

197
* Example  Further Reasons Why All Poets Are Liars
The young William Wordsworth, pushing a box about in his room, must struggle to achieve a Romantic point of view.

WI
210
** Example  Carnivale
An alternative to backdrops when we want something to be visible from a distance but only touchable from one room.

WI
211
** Example  Eddystone
Creating new commands involving the standard compass directions.

WI
92
* Example  Waterworld
A backdrop which the player can examine, but cannot interact with in any other way.

WI
77
*** Example  A View of Green Hills
A LOOK [direction] command which allows the player to see descriptions of the nearby landscape.

WI
60
** Example  Tiny Garden
A lawn made up of several rooms, with part of the description written automatically.

WI
341
** Example  Rock Garden
A simple open landscape where the player can see between rooms and will automatically move to touch things in distant rooms.

WI
342
*** Example  Stately Gardens
An open landscape where the player can see landmarks in nearby areas, with somewhat more complex room descriptions than the previous example, and in which we also account for size differences between things seen at a distance.

WI
76
** Example  Hotel Stechelberg
Signposts such as those provided on hiking paths in the Swiss Alps, which show the correct direction and hiking time to all other locations.

WI


Windows

20
** Example  Escape
Window that can be climbed through or looked through.

WI
114
* Example  Vitrine
An electrochromic window that becomes transparent or opaque depending on whether it is currently turned on.

WI
254
** Example  Port Royal 4
A cell window through which the player can see people who were in Port Royal in the current year of game-time.

WI
213
** Example  Dinner is Served
A window between two locations. When the window is open, the player can reach through into the other location; when it isn't, access is barred.

WI
178
*** Example  A Haughty Spirit
Windows overlooking lower spaces which will prevent the player from climbing through if the lower space is too far below.

WI


Lighting