Add a bunch of autogenerated index entries.
[ibg.git] / chapters / 08.rst
index c71f5bd5d47d0c230688d0c00cbf02a0603dd9f3..db5715c13fc48e2825451ea05d60b371d0c637f9 100644 (file)
@@ -68,19 +68,30 @@ square from where he's standing, we need to provide a dummy hat on a pole,
 :prop:`found_in` both this room and the north side of the square, even if it's
 "too far away" for a detailed description.
 
+.. Generated by autoindex
+.. index::
+   pair: Examine; library action
+   pair: before; library property
+
 In fact, it's "too far away" for anything.  We've replaced the standard
-:prop:`before` action for the ``Prop`` class (which permits ``Examine``, but
-rejects other actions with "You don't need to worry about...") with one
+:prop:`before` action for the ``Prop`` class (which permits :act:`Examine`,
+but rejects other actions with "You don't need to worry about...") with one
 rejecting *all* actions.  Since Wilhelm's hatred of the vogt's activities
 is central to our plot, a message saying "You don't need to worry about the
 hat" would be unacceptably misleading.
 
+.. Generated by autoindex
+.. index::
+   pair: FireAt; library action
+   pair: Talk; library action
+
 The obnoxious soldiers are also implemented very sketchily; they need to be
 there, but they don't do much.  Their most interesting characteristic is
-probably that they trap two actions -- ``FireAt`` and ``Talk`` -- which are
-*not* part of the library, but instead new actions that we've defined
-specially for this game.  We'll talk about those actions in :ref:`verbs`,
-at which time the role of this :prop:`before` property will make more sense.
+probably that they trap two actions -- :act:`FireAt` and :act:`Talk` --
+which are *not* part of the library, but instead new actions that we've
+defined specially for this game.  We'll talk about those actions in
+:ref:`verbs`, at which time the role of this :prop:`before` property will
+make more sense.
 
 The middle of the square
 ========================
@@ -100,10 +111,16 @@ on top.  He can do three things:
    attempt, patience runs out, and Wilhelm is hauled off to perform his
    party piece.
 
-So, there are two actions that we need to look out for: ``Salute`` (trapped
-by the pole), and ``Go`` (which can be trapped by the room itself).  ``Go``
-is a standard library action.  ``Salute`` is one that we've devised; let's
-deal with it first.  Here's a first cut of the room::
+.. Generated by autoindex
+.. index::
+   pair: Go; library action
+   pair: Salute; library action
+
+So, there are two actions that we need to look out for: :act:`Salute`
+(trapped by the pole), and :act:`Go` (which can be trapped by the room
+itself).  :act:`Go` is a standard library action.  :act:`Salute` is one
+that we've devised; let's deal with it first.  Here's a first cut of the
+room::
 
    Room     mid_square "Middle of the square"
      with   description
@@ -141,6 +158,10 @@ property which we've not met before: :prop:`has_been_saluted`.  What a
 remarkable coincidence: the library provides a property with a name that's
 exactly right for our game; surely not?
 
+.. Generated by autoindex
+.. index::
+   pair: has_been_saluted; library property
+
 No, of course not.  :prop:`has_been_saluted` isn't a standard library
 property; it's one that we've just invented.  Notice how easily we did it
 -- we simply included the line::
@@ -209,8 +230,8 @@ that the salute was "gratefully" received.
    :ref:`reading-other-code`.
 
 Back to the ``mid_square`` room.  We've said that we need to detect Wilhelm
-trying to leave this room, which we can do by trapping the ``Go`` action in
-a :prop:`before` property.  Let's sketch the coding we'll need::
+trying to leave this room, which we can do by trapping the :act:`Go` action
+in a :prop:`before` property.  Let's sketch the coding we'll need::
 
    before [;
       Go:
@@ -218,14 +239,24 @@ a :prop:`before` property.  Let's sketch the coding we'll need::
         if (noun == n_obj)       { Wilhelm is trying to move north }
    ];
 
-We can easily trap the ``Go`` action, but which direction is he moving?
+.. Generated by autoindex
+.. index::
+   pair: Go; library action
+   pair: s_to; library property
+
+We can easily trap the :act:`Go` action, but which direction is he moving?
 Well, it turns out that the interpreter turns a command of GO SOUTH (or
-just SOUTH) into an action of ``Go`` applied to an object ``s_obj``.  This
-object is defined by the library; so why isn't it called just "``south``"?
-Well, because we already have another kind of south, the property :prop:`s_to`
-used to say what lies in a southerly direction when defining a room.  To
-avoid confusing them, :prop:`s_to` means "south to" and ``s_obj`` means "south
-when the player types it as the object of a verb".
+just SOUTH) into an action of :act:`Go` applied to an object ``s_obj``.
+This object is defined by the library; so why isn't it called just
+"``south``"?  Well, because we already have another kind of south, the
+property :prop:`s_to` used to say what lies in a southerly direction when
+defining a room.  To avoid confusing them, :prop:`s_to` means "south to"
+and ``s_obj`` means "south when the player types it as the object of a
+verb".
+
+.. Generated by autoindex
+.. index::
+   pair: noun; library variable
 
 The identity of the object which is the target of the current action is
 stored in the :var:`noun` variable, so we can write the statement ``if (noun
@@ -320,6 +351,11 @@ not).  In effect, we're pretending that the soldier has such a short
 memory, he'll completely forget Wilhelm if our hero should move away from
 the pole.
 
+.. Generated by autoindex
+.. index::
+   pair: has_been_saluted; library property
+   pair: warnings_count; library property
+
 To do all this, we've added a new property and two statements.  The
 property is :prop:`warnings_count`, and its value will count how many times
 Wilhelm has tried to go north without saluting the pole: 0 initially, 1
@@ -468,13 +504,17 @@ isn't the 1, 2 or 3 you'd anticipated.  Here's the remainder of the code
        return true;
   }
 
+.. Generated by autoindex
+.. index::
+   pair: Go; library action
+
 The first part is really just displaying a lot of text, made slightly
 messier because we're adding emphasis to the word "Herr" by using
 underlining (which actually comes out as *italic type* on most
 interpreters).  Then, we make sure that Walter has the apple (just in case
 we didn't give it to him earlier in the game), relocate to the final room
 using ``PlayerTo(marketplace)``, and finally ``return true`` to tell the
-interpreter that we've handled this part of the ``Go`` action ourselves.
+interpreter that we've handled this part of the :act:`Go` action ourselves.
 And so, at long last, here's the complete code for the ``mid_square``, the
 most complicated object in the whole game::