.. epigraph::
- | *If they asked me, I could write a book;*
- | *About the way you TALK, and LISTEN; And LOOK.*
+ | |CENTER| *If they asked me, I could write a book;*
+ | |CENTER| *About the way you TALK, and LISTEN; And LOOK.*
-- with apologies to Richard Rodgers and Lorenz Hart.
independently and later in enjoyable collaboration -- of using, and
eventually of presenting, the Inform text adventure development system.
-| *Roger Firth*
-| *Wallingford, England*
+| |FILL| *Roger Firth*
+| |FILL| *Wallingford, England*
-| *Sonja Kesserich*
-| *Madrid, Spain*
+| |FILL| *Sonja Kesserich*
+| |FILL| *Madrid, Spain*
-| *August 2004*
+| |FILL| *August 2004*
.. rubric:: Footnotes
.. image:: /images/picP.png
:align: left
-.. raw:: latex
-
- \dropcap{p}
-
-laying IF requires just a bit of instruction. All you have to do is read
-the descriptions and situations that appear on the screen and then tell the
-game what you'd like to happen next. Imagine that you're saying "I WANT TO
-..."; you don't actually type those three words, but you *do* type what
-follows, instructing the game to do something on your behalf. Commands
-usually take the form of a simple imperative sentence, with a verb and a
-direct object (for example, typing EXAMINE THE KETTLE will display a
+|P|\laying IF requires just a bit of instruction. All you have to do is
+read the descriptions and situations that appear on the screen and then
+tell the game what you'd like to happen next. Imagine that you're saying
+"I WANT TO ..."; you don't actually type those three words, but you *do*
+type what follows, instructing the game to do something on your behalf.
+Commands usually take the form of a simple imperative sentence, with a verb
+and a direct object (for example, typing EXAMINE THE KETTLE will display a
description of the kettle, TAKE KETTLE will make it one of your belongings,
and so on). If there's more than one kettle around, you can be specific
(TAKE RED KETTLE); otherwise, the game will ask you something like "Which
.. image:: /images/picH.png
:align: left
-.. raw:: latex
-
- \dropcap{h}
-
-eidi in the Forest is our first -- and simplest -- game. We describe it in
-three chapters: "Heidi: our first Inform game" on page 33, "Reviewing the
-basics" on page 49 and "Heidi revisited" on page 59. Here is a run-time
-transcript, and then the original and extended source files.
+|H|\eidi in the Forest is our first -- and simplest -- game. We describe it
+in three chapters: "Heidi: our first Inform game" on page 33, "Reviewing
+the basics" on page 49 and "Heidi revisited" on page 59. Here is a
+run-time transcript, and then the original and extended source files.
Transcript of play
==================
.. image:: /images/picW.png
:align: left
-.. raw:: latex
-
- \dropcap{w}
-
-illiam Tell, our second game, is also very straightforward. See "William
-Tell: a tale is born" on page 69, "William Tell: the early years" on
-page 79, "William Tell: in his prime" on page 91 and "William Tell: the
+|W|\illiam Tell, our second game, is also very straightforward. See
+"William Tell: a tale is born" on page 69, "William Tell: the early years"
+on page 79, "William Tell: in his prime" on page 91 and "William Tell: the
end is nigh" on page 103.
Transcript of play
.. image:: /images/picC.png
:align: left
-.. raw:: latex
-
- \dropcap{c}
-
-aptain Fate is our third and final game; it's a little longer and more
+|C|\aptain Fate is our third and final game; it's a little longer and more
complex than its predecessors. See "Captain Fate: take 1" on page 119,
-"Captain Fate: take 2" on page 131, "Captain Fate: take 3" on page 147
-and "Captain Fate: the final cut" on page 157.
+"Captain Fate: take 2" on page 131, "Captain Fate: take 3" on page 147 and
+"Captain Fate: the final cut" on page 157.
Transcript of play
==================
.. image:: /images/picR.png
:align: left
-.. raw:: latex
-
- \dropcap{r}
-
-efer to this appendix for a succinct but essentially complete summary of
-the Inform programming language; it covers everything that we've met in
+|R|\efer to this appendix for a succinct but essentially complete summary
+of the Inform programming language; it covers everything that we've met in
this guide, plus various constructs which didn't occur naturally, and
others of an advanced or obscure nature.
.. image:: /images/picL.png
:align: left
-.. raw:: latex
-
- \dropcap{l}
-
-ibrary files define Inform's model world, turning a conventional
+|L|\ibrary files define Inform's model world, turning a conventional
programming language into a text adventure development system. Here are
the library constants, variables and routines, the standard object
properties and attributes, the verb grammars and actions.
If defined (between Includes of `Parser` and `VerbLib`), changes standard
library messages:
- .. only:: html
-
- | `Object LibraryMessages`
- | `with before [;`
- | `{action}: "{string}";`
- | `{action}: "{string}";`
- | `{action}: switch (lm_n) {`
- | `{value}: "{string}";`
- | `{value}: "{string}",`
- | `(a) lm_o,".";`
- | `...`
- | `}`
- | `...`
- | `];`
-
- .. todo::
-
- Get this to work properly in LaTeX. Currently get a 'too deeply
- nested' error.
+ | `Object LibraryMessages`
+ | `with before [;`
+ | `{action}: "{string}";`
+ | `{action}: "{string}";`
+ | `{action}: switch (lm_n) {`
+ | `{value}: "{string}";`
+ | `{value}: "{string}",`
+ | `(a) lm_o,".";`
+ | `...`
+ | `}`
+ | `...`
+ | `];`
`selfobj`
The default player object. Avoid: use instead the `player` variable,
.. image:: /images/picD.png
:align: left
-.. raw:: latex
-
- \dropcap{d}
-
-uring our travels, we've encountered certain terms which have particular
-significance in the context of the Inform text adventure development
-system; here are brief definitions of many of those specialised words and
-phrases.
+|D|\uring our travels, we've encountered certain terms which have
+particular significance in the context of the Inform text adventure
+development system; here are brief definitions of many of those specialised
+words and phrases.
.. glossary::
.. epigraph::
- | *A was an archer, who shot at a frog;*
- | *B was a butcher, who had a great dog.*
+ | |CENTER| *A was an archer, who shot at a frog;*
+ | |CENTER| *B was a butcher, who had a great dog.*
.. only:: html
.. image:: /images/picB.png
:align: left
-.. raw:: latex
-
- \dropcap{b}
-
-efore we start learning to use the Inform system, it's probably sensible
-to consider briefly how IF, which has many narrative elements, differs from
-regular storytelling. Before we do *that*, though, let's look at an example
-of a familiar folk tale.
+|B|\efore we start learning to use the Inform system, it's probably
+sensible to consider briefly how IF, which has many narrative elements,
+differs from regular storytelling. Before we do *that*, though, let's look
+at an example of a familiar folk tale.
"There was once a man called Wilhelm Tell, from high in the Swiss Alps
near the town of Altdorf. A hunter and a guide, a proud mountaineer,
.. epigraph::
- | *C was a captain, all covered with lace;*
- | *D was a drunkard, and had a red face.*
+ | |CENTER| *C was a captain, all covered with lace;*
+ | |CENTER| *D was a drunkard, and had a red face.*
.. only:: html
.. image:: /images/picC.png
:align: left
-.. raw:: latex
-
- \dropcap{c}
-
-onventional -- static -- fiction can be written using nothing more than
+|C|\onventional -- static -- fiction can be written using nothing more than
pencil and paper, or typewriter, or word-processor; however, the
requirements for producing IF are a little more extensive, and the creative
process slightly more complex.
.. epigraph::
- | *E was an esquire, with pride on his brow;*
- | *F was a farmer, and followed the plough.*
+ | |CENTER| *E was an esquire, with pride on his brow;*
+ | |CENTER| *F was a farmer, and followed the plough.*
.. only:: html
.. image:: /images/picE.png
:align: left
-.. raw:: latex
-
- \dropcap{e}
-
-ach of the three games in this guide is created step by step; you'll get
-most benefit (especially to begin with) if you take an active part, typing
-in the source code on your computer. Our first game, described in this
-chapter and the two which follow, tells this sentimental little story:
+|E|\ach of the three games in this guide is created step by step; you'll
+get most benefit (especially to begin with) if you take an active part,
+typing in the source code on your computer. Our first game, described in
+this chapter and the two which follow, tells this sentimental little story:
"Heidi lives in a tiny cottage deep in the forest. One sunny day,
standing before the cottage, she hears the frenzied tweeting of baby
.. epigraph::
- | *G was a gamester, who had but ill-luck;*
- | *H was a hunter, and hunted a buck.*
+ | |CENTER| *G was a gamester, who had but ill-luck;*
+ | |CENTER| *H was a hunter, and hunted a buck.*
.. only:: html
.. image:: /images/picG.png
:align: left
-.. raw:: latex
-
- \dropcap{g}
-
-oing through the design of our first game in the previous chapter has
+|G|\oing through the design of our first game in the previous chapter has
introduced all sorts of Inform concepts, often without giving you much
detail about what's been happening. So let's review some of what we've
learnt so far, in a slightly more organised fashion. We'll talk about
.. epigraph::
- | *I was an innkeeper, who loved to carouse;*
- | *J was a joiner, and built up a house.*
+ | |CENTER| *I was an innkeeper, who loved to carouse;*
+ | |CENTER| *J was a joiner, and built up a house.*
.. only:: html
.. image:: /images/picI.png
:align: left
-.. raw:: latex
-
- \dropcap{i}
-
-n even the simplest story, there's bound to be scope for the player to
+|I|\n even the simplest story, there's bound to be scope for the player to
attempt activities that you hadn't anticipated. Sometimes there may be
alternative ways of approaching a problem: if you can't be sure which
approach the player will take, you really ought to allow for all
.. epigraph::
- | *K was King William, once governed the land;*
- | *L was a lady, who had a white hand.*
+ | |CENTER| *K was King William, once governed the land;*
+ | |CENTER| *L was a lady, who had a white hand.*
.. only:: html
.. image:: /images/picK.png
:align: left
-.. raw:: latex
-
- \dropcap{k}
-
-eeping up the momentum, this chapter (and the three which follow) works
+|K|\eeping up the momentum, this chapter (and the three which follow) works
steadily through the design of the "William Tell" game that we encountered
right at the start of this guide. Many of the principles are the same as
the ones we explained when designing Heidi and her forest, so we'll not
.. epigraph::
- | *M was a miser, and hoarded up gold;*
- | *N was a nobleman, gallant and bold.*
+ | |CENTER| *M was a miser, and hoarded up gold;*
+ | |CENTER| *N was a nobleman, gallant and bold.*
.. only:: html
.. image:: /images/picM.png
:align: left
-.. raw:: latex
-
- \dropcap{m}
-
-oving along swiftly, we'll define the first two rooms and populate them
+|M|\oving along swiftly, we'll define the first two rooms and populate them
with assorted townspeople and street furniture, we'll equip Wilhelm with
his trusty bow and quiver of arrows, and we'll introduce Helga the friendly
stallholder.
.. epigraph::
- | *O was an oyster girl, and went about town;*
- | *P was a parson, and wore a black gown.*
+ | |CENTER| *O was an oyster girl, and went about town;*
+ | |CENTER| *P was a parson, and wore a black gown.*
.. only:: html
.. image:: /images/picO.png
:align: left
-.. raw:: latex
-
- \dropcap{o}
-
-ur game's action nears its climax in the town's central square. In this
-chapter we define the square's constituent rooms and deal with Wilhelm's
-approach to the hat on the pole -- does he salute it, or does he remain
-proudly defiant?
+|O|\ur game's action nears its climax in the town's central square. In
+this chapter we define the square's constituent rooms and deal with
+Wilhelm's approach to the hat on the pole -- does he salute it, or does he
+remain proudly defiant?
.. _south-side:
.. epigraph::
- | *Q was a queen, who wore a silk slip;*
- | *R was a robber, and wanted a whip.*
+ | |CENTER| *Q was a queen, who wore a silk slip;*
+ | |CENTER| *R was a robber, and wanted a whip.*
.. only:: html
.. image:: /images/picQ.png
:align: left
-.. raw:: latex
-
- \dropcap{q}
-
-uite a few objects still remain undefined, so we'll talk about them first.
-Then, we'll explain how to make additions to Inform's standard repertoire
-of verbs, and how to define the actions which those verbs trigger.
+|Q|\uite a few objects still remain undefined, so we'll talk about them
+first. Then, we'll explain how to make additions to Inform's standard
+repertoire of verbs, and how to define the actions which those verbs
+trigger.
The marketplace
===============
.. epigraph::
- | *S was a sailor, and spent all he got;*
- | *T was a tinker, and mended a pot.*
+ | |CENTER| *S was a sailor, and spent all he got;*
+ | |CENTER| *T was a tinker, and mended a pot.*
.. only:: html
.. image:: /images/picS.png
:align: left
-.. raw:: latex
-
- \dropcap{s}
-
-imple though they are, our two games have covered most of the basic
-functionality of Inform, providing enough solid ground underfoot
-for you to start creating simple stories. Even if some of what you've
-encountered doesn't make sense yet, you should be able to browse a
-game's source code and form a general understanding of what is going on.
+|S|\imple though they are, our two games have covered most of the basic
+functionality of Inform, providing enough solid ground underfoot for you to
+start creating simple stories. Even if some of what you've encountered
+doesn't make sense yet, you should be able to browse a game's source code
+and form a general understanding of what is going on.
We'll now design a third game, to show you a few additional features and
give you some more sample code to analyse. In "Heidi" we tried to make
discouraged; choices like this become more common (and easier) as your
experience grows.
-.. todo::
+.. Ugh. Ghastly, but it does the job.
+
+.. |WNL_LATEX| replace:: :latex:`\emph{\textbf{whatever new look}}`
- That "whatever new look" below needs to be italicized and bolded for
- LaTeX.
+.. |WNL_HTML| replace:: :html:`<strong><em>whatever new look</em></strong>`
.. note::
- Going back to our example, an alternative approach would be to set
- the variable ``player.description`` in the ``Initialise`` routine (as we
- did with "William Tell") to the "ordinary clothes" string, and then
- later change it as the need arises. It is a variable, after all, and you
- can alter its value with another statement like ``player.description =``
- *whatever new look* anywhere in your code. This alternative solution
- might be better if we intended changing the description of the player
- many times through the game. Since we plan to have only two states, the
+ Going back to our example, an alternative approach would be to set the
+ variable ``player.description`` in the ``Initialise`` routine (as we did
+ with "William Tell") to the "ordinary clothes" string, and then later
+ change it as the need arises. It is a variable, after all, and you can
+ alter its value with another statement like ``player.description =``
+ |WNL_LATEX| |WNL_HTML| anywhere in your code. This alternative solution
+ might be better if we intended changing the description of the player
+ many times through the game. Since we plan to have only two states, the
``LibraryMessages`` approach will do just fine.
A final warning: as we explained when extending the standard verb
.. epigraph::
- | *U was a usurer, a miserable elf;*
- | *V was a vintner, who drank all himself.*
+ | |CENTER| *U was a usurer, a miserable elf;*
+ | |CENTER| *V was a vintner, who drank all himself.*
.. only:: html
.. image:: /images/picV.png
:align: left
-.. raw:: latex
-
- \dropcap{v}
-
-iewed from the inside, Benny's café is warm and welcoming, and packed
-with lunchtime customers. We'll try to conjure up some appropriate
-images, but the main focus of the room isn't the decor: it's the door
-leading to the toilet -- and, perhaps, privacy?
+|V|\iewed from the inside, Benny's café is warm and welcoming, and packed
+with lunchtime customers. We'll try to conjure up some appropriate images,
+but the main focus of the room isn't the decor: it's the door leading to
+the toilet -- and, perhaps, privacy?
.. _homely-atmos:
.. epigraph::
- | *W was a watchman, and guarded the door;*
- | *X was expensive, and so became poor.*
+ | |CENTER| *W was a watchman, and guarded the door;*
+ | |CENTER| *X was expensive, and so became poor.*
.. only:: html
.. image:: /images/picW.png
:align: left
-.. raw:: latex
-
- \dropcap{w}
-
-e've given ourselves an interesting challenge by overusing that
-convenient word "toilet", and here we show you how we resolve the
-ambiguities that have been introduced. Also, it's time for the eponymous
+|W|\e've given ourselves an interesting challenge by overusing that
+convenient word "toilet", and here we show you how we resolve the
+ambiguities that have been introduced. Also, it's time for the eponymous
owner of Benny's café to be developed in full.
Too many toilets
.. epigraph::
- | *Y was a youth, that did not love school;*
- | *Z was a zany, a poor harmless fool.*
+ | |CENTER| *Y was a youth, that did not love school;*
+ | |CENTER| *Z was a zany, a poor harmless fool.*
.. only:: html
.. image:: /images/picY.png
:align: left
-.. raw:: latex
-
- \dropcap{y}
-
-ou'll probably be pleased to hear that Captain Fate has almost run his
-allotted span. There are some minor objects still to be defined -- the
-toilet, our hero’s clothes, the all-important costume -- but first we
-need to decorate the café a little more.
+|Y|\ou'll probably be pleased to hear that Captain Fate has almost run his
+allotted span. There are some minor objects still to be defined -- the
+toilet, our hero’s clothes, the all-important costume -- but first we need
+to decorate the café a little more.
Additional catering garnish
===========================
.. image:: /images/picF.png
:align: left
-.. raw:: latex
-
- \dropcap{f}
-
-inally our three example games are written; we've shown you as much of
-the Inform language as we've needed to, and made a lot of observations
-about how and why something should be done. Despite all that, there's
-much that we've left unsaid, or touched on only lightly. In this chapter
-we'll revisit key topics and review some of the more significant
-omissions, to give you a better feel for what's important, and what can
-be ignored for the time being; when you become an accomplished designer,
-you will decide what matters and what can be left on the shelf.
+|F|\inally our three example games are written; we've shown you as much of
+the Inform language as we've needed to, and made a lot of observations
+about how and why something should be done. Despite all that, there's much
+that we've left unsaid, or touched on only lightly. In this chapter we'll
+revisit key topics and review some of the more significant omissions, to
+give you a better feel for what's important, and what can be ignored for
+the time being; when you become an accomplished designer, you will decide
+what matters and what can be left on the shelf.
We'll also talk, in :ref:`reading-other-code`, about a few ways of doing
things that we've chosen not to tell you about, but which you're quite
And, who knows? It might be that next year we’ll all be smashed by
*your* entry.
-.. todo:: This signoff should be aligned to the right side.
-
-*Sonja and Roger*
+|FILL| *Sonja and Roger*
# output. They are ignored by default.
#show_authors = False
-# Global substitutions.
-rst_epilog = """
-.. |DM4| replace:: *Inform Designer's Manual*
-"""
+# Global definitions.
+rst_prolog = open("config/defs.rst").read()
# External links.
extlinks = {
--- /dev/null
+.. Global RST definitions.
+
+.. Special roles.
+
+.. role:: latex(raw)
+ :format: latex
+
+.. role:: html(raw)
+ :format: html
+
+.. Standard substitutions.
+
+.. |DM4| replace:: *Inform Designer's Manual*
+
+.. LaTeX-specific substitutions.
+
+.. |FILL| replace:: :latex:`\hfill`
+.. |CENTER| replace:: :latex:`\centering`
+
+.. |A| replace:: :latex:`\dropcap{a}`
+.. |B| replace:: :latex:`\dropcap{b}`
+.. |C| replace:: :latex:`\dropcap{c}`
+.. |D| replace:: :latex:`\dropcap{d}`
+.. |E| replace:: :latex:`\dropcap{e}`
+.. |F| replace:: :latex:`\dropcap{f}`
+.. |G| replace:: :latex:`\dropcap{g}`
+.. |H| replace:: :latex:`\dropcap{h}`
+.. |I| replace:: :latex:`\dropcap{i}`
+.. |J| replace:: :latex:`\dropcap{j}`
+.. |K| replace:: :latex:`\dropcap{k}`
+.. |L| replace:: :latex:`\dropcap{l}`
+.. |M| replace:: :latex:`\dropcap{m}`
+.. |N| replace:: :latex:`\dropcap{n}`
+.. |O| replace:: :latex:`\dropcap{o}`
+.. |P| replace:: :latex:`\dropcap{p}`
+.. |Q| replace:: :latex:`\dropcap{q}`
+.. |R| replace:: :latex:`\dropcap{r}`
+.. |S| replace:: :latex:`\dropcap{s}`
+.. |T| replace:: :latex:`\dropcap{t}`
+.. |U| replace:: :latex:`\dropcap{u}`
+.. |V| replace:: :latex:`\dropcap{v}`
+.. |W| replace:: :latex:`\dropcap{w}`
+.. |X| replace:: :latex:`\dropcap{x}`
+.. |Y| replace:: :latex:`\dropcap{y}`
+.. |Z| replace:: :latex:`\dropcap{z}`
\renewcommand{\tableofcontents}{\py@OldTableofcontents}
\makeatother
+%% Avoid too-deepy-nested problems.
+\usepackage{enumitem}
+\setlistdepth{99}
+
%% Covering page.
\def\coverpage{
\begin{titlepage}
bear in mind that such a quilt is never finished, and always has room for
one more square from a newly arrived neighbour.
-| *St Anne's College*
-| *University of Oxford*
-| *April 2002*
-
+| |FILL| *St Anne's College*
+| |FILL| *University of Oxford*
+| |FILL| *April 2002*
.. only:: html
.. toctree::
- :maxdepth: 2
copyright
history