§16   Reading matter and consultation

Making books is a skilled trade, like making clocks.
— Jean de la Bruyère (1645–1696)

“Look up figure 18 in the engineering textbook” is a difficult line for Inform to understand, because almost anything could appear in the first part: even its format depends on what the second part is. This kind of request, and more generally

>look upany words hereinthe object
>read aboutany words hereinthe object
>consultthe objectaboutany words here

cause the Consult action. In such cases, the noun is the book and there is no second object. Instead, the object has to parse the ‹any words here› part itself. The following variables are set up to make this possible:

consult_from holds the number of the first word in the ‹any…› clause;
consult_words holds the number of words in the ‹any…› clause.

The ‹any words here› clause must contain at least one word. The words given can be parsed using library routines like NextWord(), TryNumber(word-number) and so on: see §28 for full details. As usual, the before routine should return true if it has managed to deal with the action; returning false will make the library print “You discover nothing of interest in…”.

Little hints are placed here and there in the ‘Ruins’, written in the glyphs of a not altogether authentic dialect of Mayan. Our explorer has, naturally, come equipped with the latest and finest scholarship on the subject:

Object dictionary "Waldeck's Mayan dictionary"
  with name 'dictionary' 'local' 'guide' 'book' 'mayan'
            'waldeck' 'waldeck^s',
       description "Compiled from the unreliable lithographs of the
           legendary raconteur and explorer ~Count~ Jean Frederic
           Maximilien Waldeck (1766??-1875), this guide contains
           what little is known of the glyphs used in the local
           ancient dialect.",
       correct false,
       before [ w1 w2 glyph;
         Consult:
             wn = consult_from;
             w1 = NextWord(); ! First word of subject
             w2 = NextWord(); ! Second word (if any) of subject
             if (consult_words==1 && w1~='glyph' or 'glyphs') glyph = w1;
             else if (consult_words==2 && w1=='glyph') glyph = w2;
             else if (consult_words==2 && w2=='glyph') glyph = w1;
             else "Try ~look up <name of glyph> in book~.";
             switch (glyph) {
                 'q1': "(This is one glyph you have memorised!)^^
                     Q1: ~sacred site~.";
                 'crescent': "Crescent: believed pronounced ~xibalba~,
                     though its meaning is unknown.";
                 'arrow': "Arrow: ~journey; becoming~.";
                 'skull': "Skull: ~death, doom; fate (not nec. bad)~.";
                 'circle': "Circle: ~the Sun; also life, lifetime~.";
                 'jaguar': "Jaguar: ~lord~.";
                 'monkey': "Monkey: ~priest?~.";
                 'bird': if (self.correct) "Bird: ~dead as a stone~.";
                     "Bird: ~rich, affluent?~.";
                 default: "That glyph is so far unrecorded.";
             }
       ],
  has  proper;

Note that this understands any of the forms “q1”, “glyph q1” or “q1 glyph”. (These aren't genuine Maya glyphs, but some of the real ones once had similar names, dating from when their syllabic equivalents weren't known.)

▲▲ EXERCISE 25
To mark the 505th anniversary of William Tyndale, the first English translator of the New Testament (who was born some time around 1495 and burned as a heretic in Vilvorde, Denmark, in 1535), prepare an Inform edition.

· · · · ·

▲▲ Ordinarily, a request by the player to “read” something is translated into an Examine action. But the “read” verb is defined independently of the “examine” verb in order to make it easy to separate the two requests. For instance:

Attribute legible;
...
Object textbook "textbook"
  with name 'engineering' 'textbook' 'text' 'book',
       description "What beautiful covers and spine!",
       before [;
           Consult, Read:
               "The pages are full of senseless equations.";
       ],
  has  legible;
...
[ ReadSub;
  <<Examine noun>>; 
];
Extend 'read' first * legible -> Read;

Note that “read” causes a Read action only for legible objects, and otherwise causes Examine in the usual way. ReadSub is coded as a translation to Examine as well, so that if a legible object doesn't provide a Read rule then an Examine happens after all.

REFERENCES
Another possibility for parsing commands like “look up ‹something› in the catalogue”, where any object name might appear as the ‹something›, would be to extend the grammar for “look”. See §30.