Add glossary references in the correct places.
[ibg.git] / chapters / 03.rst
index 7f72e254d2a9c3164db743e88881b66516dbd82a..8dd586af8cbd6787bf5ee86139fd5169d22198ad 100644 (file)
@@ -8,6 +8,7 @@
    | *F was a farmer, and followed the plough.*
 
 .. only:: html
+
   .. image:: /images/picE.png
      :align: left
 
@@ -49,7 +50,7 @@ that we design will start out like this.  Follow these steps:
 #. In that folder, use your text editor to create this source file
    ``Heidi.inf``:
 
-   .. code-block:: inform6
+   .. code-block:: inform
 
       !% -SD
       !============================================================================
@@ -87,12 +88,12 @@ that we design will start out like this.  Follow these steps:
    Ensure the file is named ``Heidi.inf``, rather than ``Heidi.txt`` or
    ``Heidi.inf.txt``.
 
-   Remember that, throughout this guide, we place the "TYPE" symbol
+   Remember that, throughout this guide, we place the "``TYPE``" symbol
    alongside pieces of code that we recommend you to type into your own
    game files as you read through the examples (which, conversely, means
-   that you don't need to type the unmarked pieces of code).  You'll learn
-   Inform more quickly by trying it for yourself, rather than just taking
-   our word for how things work.
+   that you *don't* need to type the unmarked pieces of code).  You'll 
+   learn Inform more quickly by trying it for yourself, rather than just 
+   taking our word for how things work.
 
    .. todo::
 
@@ -166,9 +167,9 @@ looking at the source file.
   source.  The instructions most commonly placed here are compiler
   switches, a way of controlling detailed aspects of how the compiler
   operates.  These particular switches, two of many, are turning on
-  **Strict mode**, which makes the game less likely to misbehave when being
-  played, and **Debug mode**, which provides some extra commands which can
-  be helpful when tracking down problems.
+  :term:`Strict mode`, which makes the game less likely to misbehave when
+  being played, and :term:`Debug mode`, which provides some extra commands
+  which can be helpful when tracking down problems.
 
   .. note::
 
@@ -183,9 +184,9 @@ looking at the source file.
   line is ignored; if the ``!`` is halfway along a line, the compiler takes
   note of the first half, and then ignores the exclamation mark and
   everything after it on that line.  We call material following an
-  exclamation mark, not seen by anybody else, a **comment**; it's often a
-  remark that we write to remind ourselves of how something works or why we
-  tackled a problem in a particular way.  There's nothing special about
+  exclamation mark, not seen by anybody else, a :term:`comment`; it's often
+  a remark that we write to remind ourselves of how something works or why
+  we tackled a problem in a particular way.  There's nothing special about
   those equals signs: they just produce clear lines across the page.
 
   It's always a good idea to comment code as you write it, for later it
@@ -197,9 +198,9 @@ looking at the source file.
   By the way, the compiler *doesn't* give special treatment to exclamation
   marks in quoted text: ``!`` within quotes "..." is treated as a normal
   character.  On this line, the first ``!`` is part of the sequence (or
-  string) of characters to be displayed:
+  :term:`string`) of characters to be displayed:
 
-  .. code-block:: inform6
+  .. code-block:: inform
 
      print "Hello world!";         ! <- is the start of this comment
 
@@ -207,7 +208,7 @@ looking at the source file.
   space (except when the spaces are part of a character string).  So, these
   two rules tell us that we *could* have typed the source file like this:
 
-  .. code-block:: inform6
+  .. code-block:: inform
 
      Constant Story "Heidi";
      Constant Headline
@@ -221,20 +222,21 @@ looking at the source file.
   you've typed, so it's worthwhile taking a bit of care to make it as
   readable as possible.
 
-* Every game should have the **constant** definitions for ``Story`` (the
-  game's name) and ``Headline`` (typically, information on the game's
-  theme, copyright, authorship and so on).  These two **string** values,
-  along with a release number and date, and details of the compiler,
-  compose the **banner** which is displayed at the start of each game.
+* Every game should have the :term:`constant` definitions for ``Story``
+  (the game's name) and ``Headline`` (typically, information on the game's
+  theme, copyright, authorship and so on).  These two :term:`string`
+  values, along with a release number and date, and details of the
+  compiler, compose the :term:`banner` which is displayed at the start of
+  each game.
 
 * Every game needs the three lines which ``Include`` the standard library
   files -- that is, they merge those files' contents into your source file:
 
-  .. code-block:: inform6
+  .. code-block:: inform
 
      Include "Parser";
      Include "VerbLib";
-     ...
+     ...
      Include "Grammar";
 
   They always have to be in this order, with ``Parser`` and ``VerbLib``
@@ -243,13 +245,13 @@ looking at the source file.
 * Every game needs to define an ``Initialise`` routine (note the British
   spelling):
 
-  .. code-block:: inform6
+  .. code-block:: inform
 
      [ Initialise; ];
 
-  The **routine** that we've defined here doesn't do anything useful, but
-  it still needs to be present.  Later, we'll come back to ``Initialise``
-  and explain what a routine is and why we need this one.
+  The :term:`routine` that we've defined here doesn't do anything useful,
+  but it still needs to be present.  Later, we'll come back to
+  ``Initialise`` and explain what a routine is and why we need this one.
 
 * You'll notice that each of the items mentioned in the previous three
   rules ends with a semicolon.  Inform is very fussy about its punctuation,
@@ -258,7 +260,7 @@ looking at the source file.
   that's why we were able to take three lines to define the ``Headline``
   constant
 
-  .. code-block:: inform6
+  .. code-block:: inform
 
      Constant Headline
            "^A simple Inform example
@@ -282,11 +284,11 @@ involved: this sketch map shows the four that we'll use:
 .. image:: /images/heidi1.*
    :align: center
 
-In IF, we talk about each of these locations as a **room**, even though in
-this example none of them has four walls.  So let's use Inform to define
+In IF, we talk about each of these locations as a :term:`room`, even though
+in this example none of them has four walls.  So let's use Inform to define
 those rooms.  Here's a first attempt:
 
-.. code-block:: inform6
+.. code-block:: inform
 
    Object   "In front of a cottage"
      with   description
@@ -350,11 +352,11 @@ Again, we can infer some general principles from these four examples:
   commonly, that light source is the room itself.
 
 A smidgeon of background may help set this into context (there's more in
-the next chapter).  An object can have both **properties** (introduced by
-the keyword ``with``) and **attributes** (written after the word ``has``).
-A property has both a name (like ``description``) and a value (like the
-character string "``You stand outside a cottage.  The forest stretches
-east.``"); an attribute has merely a name.
+the next chapter).  An object can have both :term:`properties` (introduced
+by the keyword ``with``) and :term:`attributes` (written after the word
+``has``).  A property has both a name (like ``description``) and a value
+(like the character string "``You stand outside a cottage.  The forest
+stretches east.``"); an attribute has merely a name.
 
 In a little while, when you play this game, you'll observe that it starts
 like this:
@@ -380,7 +382,7 @@ clearing.  Now, although our descriptions mention or imply these available
 routes, we also need to explicitly add them to the room definitions in a
 form that the game itself can make sense of.  Like this:
 
-.. code-block:: inform6
+.. code-block:: inform
 
    Object   before_cottage "In front of a cottage"
      with   description
@@ -460,7 +462,7 @@ where the game starts, and we do this in the ``Initialise`` routine::
 
     [ Initialise; location = before_cottage; ];
 
-``location`` is a **variable**, part of the library, which tells the
+``location`` is a :term:`variable`, part of the library, which tells the
 interpreter in which room the player character currently is.  Here, we're
 saying that, at the start of the game, the player character is in the
 ``before_cottage`` room.
@@ -470,7 +472,7 @@ At this stage, you should study the four room definitions, comparing them
 with the sketch map until you're comfortable that you understand how to
 create simple rooms and define the connections between them.
 
-.. code-block:: inform6
+.. code-block:: inform
 
    !============================================================================
    Constant Story "Heidi";
@@ -543,7 +545,7 @@ Given what we said earlier, you won't be surprised to hear that both the
 bird and its nest are Inform objects.  We'll start their definitions like
 this:
 
-.. code-block:: inform6
+.. code-block:: inform
 
    Object  bird "baby bird"
      with  description "Too young to fly, the nestling tweets helplessly.",
@@ -571,7 +573,7 @@ relevant vocabulary so that the player can use whatever term seems
 appropriate to her, with a good chance of it being understood.  We add a
 line to each definition:
 
-.. code-block:: inform6
+.. code-block:: inform
 
    Object  bird "baby bird"
      with  description "Too young to fly, the nestling tweets helplessly.",
@@ -584,16 +586,17 @@ line to each definition:
       has  ;
 
 The ``name`` introduces a list in single quotes '...'.  We call each of
-those quoted things a **dictionary word**, and we do mean "word", not
+those quoted things a :term:`dictionary word`, and we do mean "word", not
 "phrase" (``'baby'``\ ``'bird'`` rather than ``'baby bird'``); you can't
-uses spaces, commas or periods in dictionary words, though there's a space
-*between* each one, and the whole list ends with a comma.  The idea is that
-the interpreter decides which object a player is talking about by matching
-what she types against the full set of all dictionary words.  If the player
-mentions BIRD, or BABY BIRD, or NESTLING, it's the ``baby bird`` that she
-means; if she mentions NEST, BIRD'S NEST or MOSS, it's the ``bird's nest``.
-And if she types NEST BABY or BIRD TWIGS, the interpreter will politely say
-that it doesn't understand what on earth she's talking about.
+uses spaces, commas or periods *in* dictionary words, though there's a
+space *between* each one, and the whole list ends with a comma.  The idea
+is that the interpreter decides which object a player is talking about by
+matching what she types against the full set of all dictionary words.  If
+the player mentions BIRD, or BABY BIRD, or NESTLING, it's the ``baby bird``
+that she means; if she mentions NEST, BIRD'S NEST or MOSS, it's the
+``bird's nest``. And if she types NEST BABY or BIRD TWIGS, the interpreter
+will politely say that it doesn't understand what on earth she's talking
+about.
 
 .. note::
 
@@ -622,7 +625,7 @@ that the player can type PUT (or INSERT) BIRD IN (or INTO) NEST.
 Furthermore, we label it as ``open``; this prevents the interpreter from
 asking us to open it before putting in the bird.
 
-.. code-block:: inform6
+.. code-block:: inform
 
    Object   nest "bird's nest"
      with   description "The nest is carefully woven of twigs and moss.",
@@ -634,7 +637,7 @@ To do this, we need to choose the locations where the player will find
 them.  Let's say that the bird is found in the forest, while the nest is in
 the clearing.  This is how we set this up:
 
-.. code-block:: inform6
+.. code-block:: inform
 
    Object   bird "baby bird" forest
      with   description "Too young to fly, the nestling tweets helplessly.",
@@ -656,7 +659,7 @@ but you'll find it convenient to insert them following the rooms where
 they're found.  This means adding the bird just after the forest, and the
 nest just after the clearing.  Here's the middle piece of the source file:
 
-.. code-block:: inform6
+.. code-block:: inform
 
    !============================================================================
    ! The game objects
@@ -718,7 +721,7 @@ Adding the tree and the branch
 The description of the clearing mentions a tall sycamore tree, up which the
 player character supposedly "climbs".  We'd better define it:
 
-.. code-block:: inform6
+.. code-block:: inform
 
    Object   tree "tall sycamore tree" clearing
      with   description
@@ -735,23 +738,23 @@ labelling the tree as ``scenery`` we suppress that, and also prevent it
 from being picked up by the player character.  One final object: the branch
 at the top of the tree.  Again, not many surprises in this definition:
 
-.. code-block:: inform6
+.. code-block:: inform
 
    Object   branch "wide firm bough" top_of_tree
      with   description "It's flat enough to support a small object.",
             name 'wide' 'firm' 'flat' 'bough' 'branch',
      has    static supporter;
 
-The only new things are those two labels.  ``static`` is similar to
-``scenery``: it prevents the branch from being picked up by the player
-character, but *doesn't* suppress mention of it when describing the
-setting.  And ``supporter`` is rather like the ``container`` that we used
-for the nest, except that this time the player character can put other
-objects *onto* the branch.  (In passing, we'll mention that an object can't
-normally be both a ``container`` and a ``supporter``.)  And so here are our
-objects again:
+The only new things are those two labels.  ``static`` is similar to 
+``scenery``: it prevents the branch from being picked up by the player 
+character, but *doesn't* suppress mention of it when describing the 
+setting.  And ``supporter`` is rather like the ``container`` that we 
+used for the nest, except that this time the player character can put 
+other objects *onto* the branch.  (In passing, we'll mention that an 
+object can't normally be both a ``container`` *and* a ``supporter``.)  
+And so here are our objects again:
 
-.. code-block:: inform6
+.. code-block:: inform
 
    !============================================================================
    ! The game objects
@@ -819,7 +822,7 @@ carrying the bird and the nest separately: we want the player character to
 put the bird into the nest first.  One easy way to enforce this is by
 adding a line near the top of the file:
 
-.. code-block:: inform6
+.. code-block:: inform
 
    !============================================================================
    Constant Story "Heidi";
@@ -841,7 +844,7 @@ to put the bird in the nest, take the nest to the top of the tree, and
 place it on the branch; when that happens, the game should be over.  This
 is one way of making it happen:
 
-.. code-block:: inform6
+.. code-block:: inform
 
    Object  branch "wide firm bough" top_of_tree
      with  description "It's flat enough to support a small object.",