~ubuntu-branches/ubuntu/vivid/inform/vivid

« back to all changes in this revision

Viewing changes to html/section15.html

  • Committer: Bazaar Package Importer
  • Author(s): Jan Christoph Nordholz
  • Date: 2008-05-26 22:09:44 UTC
  • mfrom: (2.1.1 lenny)
  • Revision ID: james.westby@ubuntu.com-20080526220944-ba7phz0d1k4vo7wx
Tags: 6.31.1+dfsg-1
* Remove a considerable number of files from the package
  due to unacceptable licensing terms.
* Repair library symlinks.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<HTML><HEAD><TITLE>Section 15: Reading matter and consultation</TITLE></HEAD>
2
 
<BODY BGCOLOR="#FFFFFF">
3
 
<TABLE></SMALL>
4
 
<TR><TD><TD><P>
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>
6
 
<P>
7
 
 
8
 
<BLOCKQUOTE>
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>
13
 
<BLOCKQUOTE>
14
 
look up figure 18 in the engineering textbook<BR>
15
 
</BLOCKQUOTE>
16
 
 
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
20
 
<BLOCKQUOTE>
21
 
look up <I><B>&#60;any words here&#62;</B></I> in <I><B>&#60;the object&#62;</B></I><BR>
22
 
read about <I><B>&#60;any words here&#62;</B></I> in <I><B>&#60;the object&#62;</B></I><BR>
23
 
consult <I><B>&#60;the object&#62;</B></I> about <I><B>&#60;any words here&#62;</B></I><BR>
24
 
</BLOCKQUOTE>
25
 
 
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>&#60;any words here&#62;</B></I> part itself, in a <TT>before</TT>
29
 
rule for <TT>Consult</TT>.  The following variables are set up to make this
30
 
possible:
31
 
 
32
 
<P>
33
 
 
34
 
<TT>consult_from</TT> holds the number of the first word in the <I><B>&#60;any...&#62;</B></I>
35
 
clause;
36
 
<P>
37
 
 
38
 
<TT>consult_words</TT> holds the number of words in the <I><B>&#60;any...&#62;</B></I> clause
39
 
(at least 1).
40
 
<P>
41
 
 
42
 
 
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...''.
48
 
<P>
49
 
 
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
53
 
on the subject:
54
 
<PRE>
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
62
 
           ancient dialect.",
63
 
       before
64
 
       [ w1 w2 glyph other;  Consult:
65
 
               if (consult_words&#62;2) jump GlyphHelp;
66
 
               wn=consult_from;
67
 
               w1 = NextWord(); ! First word of subject 
68
 
               w2 = NextWord(); ! Second word (if any) of subject 
69
 
               if (consult_words==1 &#38;&#38; w1=='glyph' or 'glyphs')
70
 
                   jump GlyphHelp;
71
 
               !  We want to recognise both "glyph q1" and "q1 glyph":
72
 
               glyph=w1; other=w2;
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 &#38;&#38; other~='glyph') jump GlyphHelp;
76
 
               switch(glyph)
77
 
               {   'q1': "(This is one glyph you have memorised!)^^
78
 
                          Q1: ~sacred site~.";
79
 
                   'circle': "Circle: ~the Sun; also life, lifetime~.";
80
 
                   ...
81
 
                   default: "That glyph is so far unrecorded.";
82
 
               }
83
 
               !  All three of the ways the text can go wrong lead to
84
 
               !  this message being produced:
85
 
              .GlyphHelp; "Try ~look up &#60;name of glyph&#62; in book~.";
86
 
       ],
87
 
  has  proper;
88
 
</PRE>
89
 
 
90
 
 
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.)
96
 
<P>
97
 
 
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
100
 
four Gospels.
101
 
<P>
102
 
 
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:
108
 
<PRE>
109
 
Attribute legible;
110
 
...
111
 
Object textbook "textbook"
112
 
  with name "engineering" "textbook" "text" "book",
113
 
       description "What beautiful covers and spine!",
114
 
       before
115
 
       [; Consult, Read:
116
 
           "The pages are full of senseless equations.";
117
 
       ],
118
 
       has  legible;
119
 
...
120
 
[ ReadSub; &#60;&#60;Examine noun&#62;&#62;; ];
121
 
Extend "read" first * legible                        -&#62; Read;
122
 
</PRE>
123
 
 
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.
129
 
</SMALL><TR><TD><TD>
130
 
</SMALL>
131
 
<TR><TD><TD><P>
132
 
 
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>&#60;something&#62;</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
137
 
Gareth Rees.
138
 
</TABLE>
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 &#169; Graham Nelson 1993, 1994, 1995, 1996, 1997: all rights reserved.</I></SMALL></BODY></HTML>