-
Notifications
You must be signed in to change notification settings - Fork 0
/
s16.html
163 lines (146 loc) · 7.7 KB
/
s16.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>DM4 §16: Reading matter and consultation</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="dm4.css">
</head>
<body>
<p class="navbar">
<a href="index.html">home</a> /
<a href="contents.html">contents</a> /
<a href="ch3.html" title="Chapter III: The Model World">chapter III</a> /
<a href="s15.html" title="§15: Things to enter, travel in and push around">prev</a> /
<a href="s17.html" title="§17: People and animals">next</a> /
<a href="dm4index.html">index</a>
</p>
<div class="page">
<a id="p141" name="p141"></a>
<h2>§16 Reading matter and consultation</h2>
<blockquote>Making books is a skilled trade, like making clocks.<br>
— Jean de la Bruyère (1645–1696)</blockquote>
<p class="normal"><span class="atleft"><img src="dm4-141_1.jpg" alt=""></span>
“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</p>
<p class="syntax">><tt>look up</tt> ‹<span class="token">any words here</span>› <tt>in</tt> ‹<span class="token">the object</span>›<br>
><tt>read about</tt> ‹<span class="token">any words here</span>› <tt>in</tt> ‹<span class="token">the object</span>›<br>
><tt>consult</tt> ‹<span class="token">the object</span>› <tt>about</tt> ‹<span class="token">any words here</span>›</p>
<p class="normal">cause the <code>Consult</code> action. In such cases,
the <code>noun</code> is the book and there is no <code>second</code>
object. Instead, the object has to parse the ‹<span class="token">any words here</span>› part
itself. The following variables are set up to make this possible:</p>
<p class="syntax"><code>consult_from</code> holds the number of
the first word in the ‹<span class="token">any…</span>› clause;<br>
<code>consult_words</code> holds the number of words in the
‹<span class="token">any…</span>› clause.</p>
<p class="normal">The ‹<span class="token">any words here</span>›
clause must contain at least one word. The words given can be parsed
using library routines like <code>NextWord()</code>,
<code>TryNumber(word-number)</code> and so on: see
<a href="s28.html">§28</a> for full details. As usual, the
<code>before</code> routine should return <code>true</code> if it
has managed to deal with the action; returning <code>false</code>
will make the library print “You discover nothing of interest
in…”.</p>
<p class="indent">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:</p>
<p class="lynxonly"></p>
<pre class="code">
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:<a id="p142" name="p142"></a>
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;
</pre>
<p class="normal">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.)</p>
<a id="ex25" name="ex25"></a>
<p class="aside"><span class="warning"><b>•</b>▲▲
<b><a href="sa6.html#ans25">EXERCISE 25</a></b></span><br>
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.</p>
<hr class="section-break" />
<p class="aside"><span class="warning">▲▲</span>
Ordinarily, a request by the player to “read” something
is translated into an <code>Examine</code> 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:</p>
<p class="lynxonly"></p>
<pre class="code">
Attribute legible;
...
Object textbook "textbook"
with name 'engineering' 'textbook' 'text' 'book',
description "What beautiful covers and spine!",<a id="p143" name="p143"></a>
before [;
Consult, Read:
"The pages are full of senseless equations.";
],
has legible;
...
[ ReadSub;
<<Examine noun>>;
];
Extend 'read' first * legible -> Read;
</pre>
<p class="aside">Note that “read” causes a <code>Read</code>
action only for <code>legible</code> objects, and otherwise causes
<code>Examine</code> in the usual way. <code>ReadSub</code> is coded
as a translation to <code>Examine</code> as well, so that
if a <code>legible</code> object doesn't provide a <code>Read</code>
rule then an <code>Examine</code> happens after all.</p>
<p class="aside"><span class="warning"><b>•</b>
<b>REFERENCES</b></span><br>
Another possibility for parsing commands like “look up ‹<span class="token">something</span>›
in the catalogue”, where any object name might appear as the
‹<span class="token">something</span>›, would be to extend the grammar
for “look”. See <a href="s30.html">§30</a>.</p>
</div>
<p class="navbar">
<a href="index.html">home</a> /
<a href="contents.html">contents</a> /
<a href="ch3.html" title="Chapter III: The Model World">chapter III</a> /
<a href="s15.html" title="§15: Things to enter, travel in and push around">prev</a> /
<a href="s17.html" title="§17: People and animals">next</a> /
<a href="dm4index.html">index</a>
</p>
</body>
</html>