1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
4
<title>DM4 §16: Reading matter and consultation</title>
5
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
6
<link rel="stylesheet" type="text/css" href="dm4.css">
10
<a href="index.html">home</a> /
11
<a href="contents.html">contents</a> /
12
<a href="ch3.html" title="Chapter III: The Model World">chapter III</a> /
13
<a href="s15.html" title="§15: Things to enter, travel in and push around">prev</a> /
14
<a href="s17.html" title="§17: People and animals">next</a> /
15
<a href="dm4index.html">index</a>
18
<a id="p141" name="p141"></a>
19
<h2>§16 Reading matter and consultation</h2>
21
<blockquote>Making books is a skilled trade, like making clocks.<br>
22
— Jean de la Bruyère (1645–1696)</blockquote>
24
<p class="normal"><span class="atleft"><img src="dm4-141_1.jpg" alt=""></span>
25
“Look up figure 18 in the engineering textbook” is a
26
difficult line for Inform to understand, because almost anything could
27
appear in the first part: even its format depends on what the second
28
part is. This kind of request, and more generally</p>
30
<p class="syntax">><tt>look up</tt> ‹<span class="token">any words here</span>› <tt>in</tt> ‹<span class="token">the object</span>›<br>
31
><tt>read about</tt> ‹<span class="token">any words here</span>› <tt>in</tt> ‹<span class="token">the object</span>›<br>
32
><tt>consult</tt> ‹<span class="token">the object</span>› <tt>about</tt> ‹<span class="token">any words here</span>›</p>
34
<p class="normal">cause the <code>Consult</code> action. In such cases,
35
the <code>noun</code> is the book and there is no <code>second</code>
36
object. Instead, the object has to parse the ‹<span class="token">any words here</span>› part
37
itself. The following variables are set up to make this possible:</p>
39
<p class="syntax"><code>consult_from</code> holds the number of
40
the first word in the ‹<span class="token">any…</span>› clause;<br>
41
<code>consult_words</code> holds the number of words in the
42
‹<span class="token">any…</span>› clause.</p>
44
<p class="normal">The ‹<span class="token">any words here</span>›
45
clause must contain at least one word. The words given can be parsed
46
using library routines like <code>NextWord()</code>,
47
<code>TryNumber(word-number)</code> and so on: see
48
<a href="s28.html">§28</a> for full details. As usual, the
49
<code>before</code> routine should return <code>true</code> if it
50
has managed to deal with the action; returning <code>false</code>
51
will make the library print “You discover nothing of interest
54
<p class="indent">Little hints are placed here and there in the
55
‘Ruins’, written in the glyphs of a not altogether
56
authentic dialect of Mayan. Our explorer has, naturally, come
57
equipped with the latest and finest scholarship on the subject:</p>
59
<p class="lynxonly"></p>
61
Object dictionary "Waldeck's Mayan dictionary"
62
with name 'dictionary' 'local' 'guide' 'book' 'mayan'
63
'waldeck' 'waldeck^s',
64
description "Compiled from the unreliable lithographs of the
65
legendary raconteur and explorer ~Count~ Jean Frederic
66
Maximilien Waldeck (1766??-1875), this guide contains
67
what little is known of the glyphs used in the local
68
ancient dialect.",
71
Consult:<a id="p142" name="p142"></a>
73
w1 = NextWord(); ! First word of subject
74
w2 = NextWord(); ! Second word (if any) of subject
75
if (consult_words==1 && w1~='glyph' or 'glyphs') glyph = w1;
76
else if (consult_words==2 && w1=='glyph') glyph = w2;
77
else if (consult_words==2 && w2=='glyph') glyph = w1;
78
else "Try ~look up <name of glyph> in book~.";
80
'q1': "(This is one glyph you have memorised!)^^
81
Q1: ~sacred site~.";
82
'crescent': "Crescent: believed pronounced ~xibalba~,
83
though its meaning is unknown.";
84
'arrow': "Arrow: ~journey; becoming~.";
85
'skull': "Skull: ~death, doom; fate (not nec. bad)~.";
86
'circle': "Circle: ~the Sun; also life, lifetime~.";
87
'jaguar': "Jaguar: ~lord~.";
88
'monkey': "Monkey: ~priest?~.";
89
'bird': if (self.correct) "Bird: ~dead as a stone~.";
90
"Bird: ~rich, affluent?~.";
91
default: "That glyph is so far unrecorded.";
97
<p class="normal">Note that this understands any of the forms “q1”,
98
“glyph q1” or “q1 glyph”. (These aren't genuine
99
Maya glyphs, but some of the real ones once had similar names, dating
100
from when their syllabic equivalents weren't known.)</p>
102
<a id="ex25" name="ex25"></a>
103
<p class="aside"><span class="warning"><b>•</b>▲▲
104
<b><a href="sa6.html#ans25">EXERCISE 25</a></b></span><br>
105
To mark the 505th anniversary of William Tyndale, the first English
106
translator of the New Testament (who was born some time around
107
1495 and burned as a heretic in Vilvorde, Denmark, in 1535), prepare
108
an Inform edition.</p>
110
<p class="dotbreak">� � � � �</p>
112
<p class="aside"><span class="warning">▲▲</span>
113
Ordinarily, a request by the player to “read” something
114
is translated into an <code>Examine</code> action. But the “read”
115
verb is defined independently of the “examine” verb
116
in order to make it easy to separate the two requests. For instance:</p>
118
<p class="lynxonly"></p>
122
Object textbook "textbook"
123
with name 'engineering' 'textbook' 'text' 'book',
124
description "What beautiful covers and spine!",<a id="p143" name="p143"></a>
127
"The pages are full of senseless equations.";
132
<<Examine noun>>;
134
Extend 'read' first * legible -> Read;
137
<p class="aside">Note that “read” causes a <code>Read</code>
138
action only for <code>legible</code> objects, and otherwise causes
139
<code>Examine</code> in the usual way. <code>ReadSub</code> is coded
140
as a translation to <code>Examine</code> as well, so that
141
if a <code>legible</code> object doesn't provide a <code>Read</code>
142
rule then an <code>Examine</code> happens after all.</p>
144
<p class="aside"><span class="warning"><b>•</b>
145
<b>REFERENCES</b></span><br>
146
Another possibility for parsing commands like “look up ‹<span class="token">something</span>›
147
in the catalogue”, where any object name might appear as the
148
‹<span class="token">something</span>›, would be to extend the grammar
149
for “look”. See <a href="s30.html">§30</a>.</p>
153
<a href="index.html">home</a> /
154
<a href="contents.html">contents</a> /
155
<a href="ch3.html" title="Chapter III: The Model World">chapter III</a> /
156
<a href="s15.html" title="§15: Things to enter, travel in and push around">prev</a> /
157
<a href="s17.html" title="§17: People and animals">next</a> /
158
<a href="dm4index.html">index</a>