1
<HTML><HEAD><TITLE>Section 15: Reading matter and consultation</TITLE></HEAD>
2
<BODY BGCOLOR="#FFFFFF">
5
<TR><TD Valign="top"><A HREF="contents.html">Contents</A><BR><A HREF="section14.html">Back</A><BR><A HREF="section16.html">Forward</A><TD bgcolor="#F5DEB3"><BLOCKQUOTE><H3>15. Reading matter and consultation</H3></BLOCKQUOTE><TR><TD><TD>
9
Even at present... we still know very little about how access
10
to printed materials affects human behaviour.
11
<P>...Elizabeth Eisenstein, <I>The Printing Revolution
12
in Early Modern Europe</I></BLOCKQUOTE>
14
look up figure 18 in the engineering textbook<BR>
17
is a difficult line for Inform to understand, because almost anything
18
could appear in the first part: even its format depends on what the
19
second part is. This kind of request, and more generally
21
look up <I><B><any words here></B></I> in <I><B><the object></B></I><BR>
22
read about <I><B><any words here></B></I> in <I><B><the object></B></I><BR>
23
consult <I><B><the object></B></I> about <I><B><any words here></B></I><BR>
26
cause the <TT>Consult object</TT> action. Note that <TT>second</TT> is just zero:
27
formally, there is no second noun attached to a <TT>Consult</TT> action.
28
The object has to parse the <I><B><any words here></B></I> part itself, in a <TT>before</TT>
29
rule for <TT>Consult</TT>. The following variables are set up to make this
34
<TT>consult_from</TT> holds the number of the first word in the <I><B><any...></B></I>
38
<TT>consult_words</TT> holds the number of words in the <I><B><any...></B></I> clause
43
The words given are parsed using library routines like
44
<TT>NextWord()</TT>, <TT>TryNumber(word-number)</TT> and so on: see <A HREF="section24.html">Section 24</A> for
45
full details. As usual, the <TT>before</TT> routine should return true
46
if it has managed to deal with the action; returning false will
47
make the library print "You discover nothing of interest in...''.
50
Little hints are placed here and there in the 'Ruins', written
51
in the glyphs of an ancient dialect of Mayan. Our explorer has,
52
of course, come equipped with the latest and finest scholarship
55
Object dictionary "Waldeck's Mayan dictionary"
56
with name "dictionary" "local" "guide" "book" "mayan"
57
"waldeck" "waldeck^s",
58
description "Compiled from the unreliable lithographs of the
59
legendary raconteur and explorer ~Count~ Jean Frederic
60
Maximilien Waldeck (1766??-1875), this guide contains
61
what little is known of the glyphs used in the local
64
[ w1 w2 glyph other; Consult:
65
if (consult_words>2) jump GlyphHelp;
67
w1 = NextWord(); ! First word of subject
68
w2 = NextWord(); ! Second word (if any) of subject
69
if (consult_words==1 && w1=='glyph' or 'glyphs')
71
! We want to recognise both "glyph q1" and "q1 glyph":
73
if (w1=='glyph') { glyph=w2; other=w1; }
74
! So now glyph holds the name, and other the other word
75
if (consult_words==2 && other~='glyph') jump GlyphHelp;
77
{ 'q1': "(This is one glyph you have memorised!)^^
79
'circle': "Circle: ~the Sun; also life, lifetime~.";
81
default: "That glyph is so far unrecorded.";
83
! All three of the ways the text can go wrong lead to
84
! this message being produced:
85
.GlyphHelp; "Try ~look up <name of glyph> in book~.";
91
Note that this understands any of the forms "q1'', "glyph q1'' or
92
"q1 glyph'' but is careful to reject, for instance, "glyph q1 glyph''.
93
(These aren't genuine Mayan glyphs, but some of the real ones have similar
94
names, dating from when their syllabic equivalents weren't known: G8,
95
the Lord of the Night, for instance.)
98
<P><TR><TD Valign="top"><IMG SRC="icons/exercise.gif" ALT="??"><TD bgcolor="#FBB9AC"><A NAME="ex17"><B>EXERCISE 17:</B><BR>(link to <A HREF="answers1/answer17.html">the answer</A>)<TR><TD><TD> To mark the 500th anniversary of William Tyndale (the first
99
English translator of the New Testament), prepare an edition of the
103
<P><TR><TD Valign="top"><IMG SRC="icons/ddbend.gif" ALT="/\/\"><TD bgcolor="#EEEEEE"><SMALL>
104
Ordinarily, a request by the player to "read'' something is translated
105
into an <TT>Examine</TT> action. But the "read'' verb is defined independently
106
of the "examine'' verb in order to make it easy to separate the two
107
requests. For instance:
111
Object textbook "textbook"
112
with name "engineering" "textbook" "text" "book",
113
description "What beautiful covers and spine!",
116
"The pages are full of senseless equations.";
120
[ ReadSub; <<Examine noun>>; ];
121
Extend "read" first * legible -> Read;
124
<TR><TD><TD bgcolor="#EEEEEE"><SMALL>
125
Note that "read" causes a <TT>Read</TT> action only for <TT>legible</TT> objects,
126
and otherwise causes <TT>Examine</TT> in the usual way. <TT>ReadSub</TT> is coded
127
as a translation to <TT>Examine</TT> as well, so that if a <TT>legible</TT> object
128
doesn't provide a <TT>Read</TT> rule then an <TT>Examine</TT> happens after all.
133
<P><TR><TD Valign="top"><IMG SRC="icons/refs.gif" ALT="*"><TD bgcolor="#EEEEEE"><B>REFERENCES:</B><BR><SMALL> If you really need more elaborate topic-parsing (for, e.g.,
134
"look up <I><B><something></B></I> in the catalogue'', where any object name might
135
appear) then extending the grammar for <TT>look</TT> may be less trouble.
136
For a good implementation see 'Encyclopaedia Frobozzica', by
139
<HR><A HREF="contents.html">Contents</A> / <A HREF="section14.html">Back</A> / <A HREF="section16.html">Forward</A> <BR>
140
<A HREF="chapter1.html">Chapter I</A> / <A HREF="chapter2.html">Chapter II</A> / <A HREF="chapter3.html">Chapter III</A> / <A HREF="chapter4.html">Chapter IV</A> / <A HREF="chapter5.html">Chapter V</A> / <A HREF="chapter6.html">Chapter VI</A> / <A HREF="chapterA.html">Appendix</A><HR><SMALL><I>Mechanically translated to HTML from third edition as revised 16 May 1997. Copyright © Graham Nelson 1993, 1994, 1995, 1996, 1997: all rights reserved.</I></SMALL></BODY></HTML>