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

« back to all changes in this revision

Viewing changes to inform-6.31.1/manual/sa3.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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
 
2
<html>
 
3
<head>
 
4
<title>DM4 &#167;A3: Library routines</title>
 
5
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
 
6
<link rel="stylesheet" type="text/css" href="dm4.css">
 
7
</head>
 
8
<body>
 
9
<p class="navbar">
 
10
 <a href="index.html">home</a> /
 
11
 <a href="contents.html">contents</a> /
 
12
 <a href="app.html">appendices</a> /
 
13
 <a href="sa2.html" title="&#167;A2: Library properties">prev</a> /
 
14
 <a href="sa4.html" title="&#167;A4: Library message numbers">next</a> /
 
15
 <a href="dm4index.html">index</a>
 
16
</p>
 
17
<div class="page">
 
18
<a id="p429" name="p429"></a>
 
19
<h2>&#167;A3 &nbsp; Library routines</h2>
 
20
 
 
21
<p class="normal">The Inform library files contain about three hundred 
 
22
routines, almost all of which are &#8220;private&#8221; in the sense 
 
23
that they are difficult for designers to use, not useful anyway, and 
 
24
subject to change without notice as the library is maintained and 
 
25
rewritten. The routines in this appendix are those which are &#8220;open 
 
26
to the public&#8221;. Designers are encouraged to make use of them.</p>
 
27
 
 
28
<p class="lynxonly"></p>
 
29
<table class="sa2">
 
30
<tr class="r1"><td class="c1"><code>Achieved(tasknum)</code> &nbsp;</td>
 
31
<td class="c2"><i>see</i> <a href="s22.html">&#167;22</a></td></tr>
 
32
</table>
 
33
<p class="normal">Signals to the library that task number <code>tasknum</code> 
 
34
has been achieved, so that points may be awarded if it has not been 
 
35
achieved before.<br>
 
36
<i>No return value</i></p>
 
37
 
 
38
<p class="lynxonly"></p>
 
39
<table class="sa2">
 
40
<tr class="r1"><td class="c1"><code>AfterRoutines()</code> &nbsp;</td>
 
41
<td class="c2"><i>see</i> <a href="s6.html">&#167;6</a></td></tr>
 
42
</table>
 
43
<p class="normal">This should be called in the action routine, such 
 
44
as <code>TakeSub</code>, of a group 2 action, such as <code>Take</code>, 
 
45
once the action has taken place but before anything is printed. It 
 
46
runs through the <code>after</code> rules as laid out in 
 
47
<a href="s6.html">&#167;6</a>.<br>
 
48
<i>Routine returns</i> &nbsp; <code>true</code> if 
 
49
the action has been interrupted by some other rule, <code>false</code> 
 
50
if not.</p>
 
51
 
 
52
<p class="lynxonly"></p>
 
53
<table class="sa2">
 
54
<tr class="r1"><td class="c1"><code>AllowPushDir()</code> &nbsp;</td>
 
55
<td class="c2"><i>see</i> <a href="s15.html">&#167;15</a></td></tr>
 
56
</table>
 
57
<p class="normal">Used only inside the <code>before</code> rule for a 
 
58
<code>PushDir</code> action, this routine signals to the library that 
 
59
the attempt to push an object from one place to another should be allowed.<br>
 
60
<i>No return value</i></p>
 
61
 
 
62
<p class="lynxonly"></p>
 
63
<table class="sa2">
 
64
<tr class="r1"><td class="c1"><code>Banner()</code> &nbsp;</td>
 
65
<td class="c2"><i>see</i> <a href="s21.html">&#167;21</a></td></tr>
 
66
</table>
 
67
<p class="normal">Prints the game banner. Normally unnecessary, but 
 
68
should be used soon after if your game suppresses the banner at the 
 
69
<code>Initialise</code> stage.<br>
 
70
<i>No return value</i></p>
 
71
 
 
72
<p class="lynxonly"></p>
 
73
<table class="sa2">
 
74
<tr class="r1"><td class="c1"><code>ChangePlayer(obj,flag)</code> &nbsp;</td>
 
75
<td class="c2"><i>see</i> <a href="s21.html">&#167;21</a></td></tr>
 
76
</table>
 
77
<p class="normal">Cause the player at the keyboard to play as the given 
 
78
object <code>obj</code>, which must provide a <code>number</code> 
 
79
property. If the <code>flag</code> is <code>true</code>, then subsequently print 
 
80
messages like &#8220;(as Ford Prefect)&#8221; in room description 
 
81
headers. This routine, however, prints nothing itself.<br>
 
82
<i>No return value</i></p>
 
83
 
 
84
<p class="lynxonly"></p>
 
85
<table class="sa2">
 
86
<tr class="r1"><td class="c1"><code>CommonAncestor(obj1,obj2)</code> &nbsp;</td>
 
87
<td class="c2"><i>see</i> <a href="s3.html">&#167;3</a></td></tr>
 
88
</table>
 
89
<p class="normal">A routine used internally by the library when working 
 
90
out visibilities, and which might as well be available for public use. 
 
91
Returns the nearest object in the object tree which (directly or 
 
92
indirectly) contains both <code>obj1</code> and <code>obj2</code>, or 
 
93
else returns <code>nothing</code> if no such object exists. For 
 
94
instance if Bedquilt contains bottle and the player is carrying a lamp,
 
95
the common ancestor of lamp and bottle is Bedquilt.<br>
 
96
<i>Routine returns</i> &nbsp; The common ancestor or 
 
97
<code>nothing</code>.</p>
 
98
 
 
99
<p class="lynxonly"></p>
 
100
<a id="p430" name="p430"></a>
 
101
<table class="sa2">
 
102
<tr class="r1"><td class="c1"><code>DictionaryLookup(word,length)</code> &nbsp;</td>
 
103
<td class="c2"><i>see</i> <a href="s34.html">&#167;34</a></td></tr>
 
104
</table>
 
105
<p class="normal">Takes the word stored character by character in the 
 
106
array <code>word-&gt;0</code>, <code>word-&gt;1</code>, &#8230;,
 
107
<code>word-&gt;(length-1)</code> and looks it up in the story file's 
 
108
dictionary.<br>
 
109
<i>Routine returns</i> &nbsp; The dictionary value 
 
110
(e.g., <code>'t'</code>, <code>'a'</code>, <code>'k'</code>, 
 
111
<code>'e'</code> will return <code>'take'</code>) or zero if the word 
 
112
isn't in the dictionary.</p>
 
113
 
 
114
<p class="lynxonly"></p>
 
115
<table class="sa2">
 
116
<tr class="r1"><td class="c1"><code>GetGNAOfObject(obj)</code> &nbsp;</td>
 
117
<td class="c2"><i>see</i> <a href="s37.html">&#167;37</a></td></tr>
 
118
</table>
 
119
<p class="normal">Determines the gender-number-animation of the short 
 
120
name of the given object <code>obj</code>.<br>
 
121
<i>Routine returns</i> &nbsp; The GNA, which is 
 
122
a number between 0 and 11: see table of GNA values in 
 
123
<a href="s34.html">&#167;34</a>.</p>
 
124
 
 
125
<p class="lynxonly"></p>
 
126
<table class="sa2">
 
127
<tr class="r1"><td class="c1"><code>HasLightSource(obj)</code> &nbsp;</td>
 
128
<td class="c2"><i>see</i> <a href="s19.html">&#167;19</a></td></tr>
 
129
</table>
 
130
<p class="normal">Determines whether or not <code>obj</code> &#8220;has light&#8221;, 
 
131
i.e., casts light outward to objects containing <code>obj</code>: see 
 
132
<a href="s19.html">&#167;19</a> for a more exact definition.<br>
 
133
<i>Routine returns</i> &nbsp; <code>true</code> 
 
134
or <code>false</code>.</p>
 
135
 
 
136
<p class="lynxonly"></p>
 
137
<table class="sa2">
 
138
<tr class="r1"><td class="c1"><code>IndirectlyContains(obj1,obj2)</code> &nbsp;</td>
 
139
<td class="c2"><i>see</i> <a href="s3.html">&#167;3</a></td></tr>
 
140
</table>
 
141
<p class="normal">The condition <code>obj2 in obj1</code> only tests whether 
 
142
<code>obj2</code> is directly contained in <code>obj1</code>, so
 
143
that <code>lamp in player</code> would fail if the lamp were in a 
 
144
rucksack carried by the player. <code>IndirectlyContains(player,lamp)</code> 
 
145
would return <code>true</code>. Formally, the test is whether
 
146
<code>obj2</code> is a child of <code>obj1</code>, or is a child of 
 
147
a child of <code>obj1</code>, or &#8230; and so on. See also the
 
148
library routine <code>CommonAncestor</code> above.<br>
 
149
<i>Routine returns</i> &nbsp; <code>true</code> or 
 
150
<code>false</code>.</p>
 
151
 
 
152
<p class="lynxonly"></p>
 
153
<table class="sa2">
 
154
<tr class="r1"><td class="c1"><code>IsSeeThrough(obj)</code> &nbsp;</td>
 
155
<td class="c2"><i>see</i> <a href="s19.html">&#167;19</a></td></tr>
 
156
</table>
 
157
<p class="normal">Determines whether or not <code>obj</code> &#8220;is 
 
158
see-through&#8221;, i.e., allows light to pass through it. An object is 
 
159
see-through if it has <code>transparent</code>, or <code>supporter</code>, 
 
160
or <code>enterable</code> (unless it is also a closed <code>container</code>).<br>
 
161
<i>Routine returns</i> &nbsp; <code>true</code> 
 
162
or <code>false</code>.</p>
 
163
 
 
164
<p class="lynxonly"></p>
 
165
<table class="sa2">
 
166
<tr class="r1"><td class="c1"><code>Locale(obj,tx1,tx2)</code> &nbsp;</td>
 
167
<td class="c2"><i>see</i> <a href="s26.html">&#167;26</a></td></tr>
 
168
</table>
 
169
<p class="normal">Prints out the paragraphs of room description which 
 
170
would appear if <code>obj</code> were the room: i.e., prints out 
 
171
descriptions of objects in <code>obj</code> according to the usual rules. 
 
172
After describing the objects which have their own paragraphs, a list 
 
173
is given of the remaining ones. The string <code>tx1</code> is printed 
 
174
if there were no previous paragraphs, and the string <code>tx2</code>
 
175
otherwise. (For instance, you might want &#8220;On the ledge you can 
 
176
see&#8221; and &#8220;On the ledge you can also see&#8221;.) After 
 
177
the list, nothing else is printed, not even a full stop.<br>
 
178
<i>Routine returns</i> &nbsp; The number of objects 
 
179
printed in the list, possibly zero.</p>
 
180
 
 
181
<p class="lynxonly"></p>
 
182
<a id="p431" name="p431"></a>
 
183
<table class="sa2">
 
184
<tr class="r1"><td class="c1"><code>LoopOverScope(R,actor)</code> &nbsp;</td>
 
185
<td class="c2"><i>see</i> <a href="s32.html">&#167;32</a></td></tr>
 
186
</table>
 
187
<p class="normal">Calls routine <code>R(obj)</code> for each object 
 
188
<code>obj</code> in scope for the given <code>actor</code>. If no 
 
189
<code>actor</code> is given, the actor is assumed to be the player.<br>
 
190
<i>No return value</i></p>
 
191
 
 
192
<p class="lynxonly"></p>
 
193
<table class="sa2">
 
194
<tr class="r1"><td class="c1"><code>LTI_Insert(position,character)</code> &nbsp;</td>
 
195
<td class="c2"><i>see</i> <a href="s36.html">&#167;36</a></td></tr>
 
196
</table>
 
197
<p class="normal">Inserts the given <code>character</code> at the given 
 
198
<code>position</code> in the standard library array <code>buffer</code>
 
199
used to hold the text typed by the player, moving subsequent text along 
 
200
to make room. (This is protected against overflowing the buffer.)<br>
 
201
<i>No return value</i></p>
 
202
 
 
203
<p class="lynxonly"></p>
 
204
<table class="sa2">
 
205
<tr class="r1"><td class="c1"><code>MoveFloatingObjects()</code> &nbsp;</td>
 
206
<td class="c2"><i>see</i> <a href="s8.html">&#167;8</a></td></tr>
 
207
</table>
 
208
<p class="normal">&#8220;Floating objects&#8221; is Inform library jargon 
 
209
for &#8220;objects which use <code>found_in</code> to be present in 
 
210
several locations at once&#8221;. This routine adjusts the positions 
 
211
of objects across the whole game, ensuring that they are consistent 
 
212
with the current states of the property <code>found_in</code> and 
 
213
the attribute <code>absent</code>, and should be called after any 
 
214
game event which has changed these states.<br>
 
215
<i>No return value</i></p>
 
216
 
 
217
<p class="lynxonly"></p>
 
218
<table class="sa2">
 
219
<tr class="r1"><td class="c1"><code>NextWord()</code> &nbsp;</td>
 
220
<td class="c2"><i>see</i> <a href="s28.html">&#167;28</a></td></tr>
 
221
</table>
 
222
<p class="normal">Finds the next dictionary word in the player's input, 
 
223
that is, the word at position <code>wn</code> in the input, moving the 
 
224
word number <code>wn</code> on by one. (The first word is at position 1.)<br>
 
225
<i>Routine returns</i> &nbsp; The dictionary value, 
 
226
or 0 if the word is not in the dictionary or if the word stream has 
 
227
run out, or the constant <code>THEN1__WD</code> if the &#8220;word&#8221; 
 
228
was a full stop, or the constant <code>COMMA_WORD</code> if it was 
 
229
a comma.</p>
 
230
 
 
231
<p class="lynxonly"></p>
 
232
<table class="sa2">
 
233
<tr class="r1"><td class="c1"><code>NextWordStopped()</code> &nbsp;</td>
 
234
<td class="c2"><i>see</i> <a href="s28.html">&#167;28</a></td></tr>
 
235
</table>
 
236
<p class="normal">Finds the next dictionary word in the player's input, 
 
237
that is, the word at position <code>wn</code> in the input, moving 
 
238
the word number <code>wn</code> on by one. (The first word is at position 1.)<br>
 
239
<i>Routine returns</i> &nbsp; The dictionary value, 
 
240
or 0 if the word is not in the dictionary, or the constant <code>THEN1__WD</code> 
 
241
if the &#8220;word&#8221; was a full stop, or the constant <code>COMMA_WORD</code> 
 
242
if it was a comma, or &#8722;1 if the word stream has run out.</p>
 
243
 
 
244
<p class="lynxonly"></p>
 
245
<table class="sa2">
 
246
<tr class="r1"><td class="c1"><code>NounDomain(o1,o2,type)</code></td>
 
247
</tr></table>
 
248
<p class="normal">This routine is one of the keystones of the parser, 
 
249
but see also <code>ParseToken</code> below: the objects given are the 
 
250
domains to search through when parsing, almost always the location 
 
251
and the actor, and the <code>type</code> indicates a token. The only 
 
252
tokens safely usable are: <code>NOUN_TOKEN</code>, for 
 
253
<span class="grammartoken"><code>noun</code></span>, <code>HELD_TOKEN</code>, 
 
254
for <span class="grammartoken"><code>held</code></span> and <code>CREATURE_TOKEN</code>, 
 
255
for <span class="grammartoken"><code>creature</code></span>. The routine 
 
256
parses the best single object name it can from the current position of 
 
257
<code>wn</code>.<br>
 
258
<i>Routine returns</i> &nbsp; <code>nothing</code> 
 
259
for &#8220;no match&#8221;, or the object matched for a success, or
 
260
the constant <code>REPARSE_CODE</code> to indicate that it had to ask 
 
261
a clarifying question: this 
 
262
<a id="p432" name="p432"></a>
 
263
reconstructed the input drastically and 
 
264
the parser must begin all over again. <code>NounDomain</code> should 
 
265
only be used by general parsing routines and these should always return
 
266
<code>GPR_REPARSE</code> if <code>NounDomain</code> returned 
 
267
<code>REPARSE_CODE</code>, thus passing the buck upwards.</p>
 
268
 
 
269
<p class="lynxonly"></p>
 
270
<table class="sa2">
 
271
<tr class="r1"><td class="c1"><code>ObjectIsUntouchable(obj,flag)</code> &nbsp;</td>
 
272
<td class="c2"><i>see</i> <a href="s32.html">&#167;32</a></td></tr>
 
273
</table>
 
274
<p class="normal">Determines whether any solid barrier, that is, any 
 
275
<code>container</code> that is not <code>open</code>, lies between 
 
276
the player and <code>obj</code>. If <code>flag</code> is <code>true</code>, 
 
277
this routine never prints anything; otherwise it prints a message like 
 
278
&#8220;You can't, because &#8230; is in the way.&#8221; if any barrier
 
279
is found.<br>
 
280
<i>Routine returns</i> &nbsp; <code>true</code> if 
 
281
a barrier is found, <code>false</code> if not.</p>
 
282
 
 
283
<p class="lynxonly"></p>
 
284
<table class="sa2">
 
285
<tr class="r1"><td class="c1"><code>OffersLight(obj)</code> &nbsp;</td>
 
286
<td class="c2"><i>see</i> <a href="s19.html">&#167;19</a></td></tr>
 
287
</table>
 
288
<p class="normal">Determines whether or not <code>obj</code> &#8220;offers 
 
289
light&#8221;, i.e., contains light so that its contents are visible 
 
290
to each other: see <a href="s19.html">&#167;19</a> for a more exact 
 
291
definition.<br>
 
292
<i>Routine returns</i> &nbsp; <code>true</code> or <code>false</code>.</p>
 
293
 
 
294
<p class="lynxonly"></p>
 
295
<table class="sa2">
 
296
<tr class="r1"><td class="c1"><code>ParseToken(tokentype,tokendata)</code> &nbsp;</td>
 
297
<td class="c2"><i>see</i> <a href="s31.html">&#167;31</a></td></tr>
 
298
</table>
 
299
<p class="normal">This is the library's own &#8220;general parsing routine&#8221;, 
 
300
and parses the word stream against the specified token. Because some 
 
301
of these tokens require too much setting-up work to parse, and anyway 
 
302
are not very useful, only two token types are open to the public. If 
 
303
<code>tokentype</code> is <code>ELEMENTARY_TT</code>, then <code>tokendata</code> 
 
304
must have one of the following values: <code>NOUN_TOKEN</code>, 
 
305
<code>HELD_TOKEN</code>, <code>MULTI_TOKEN</code>, <code>MULTIHELD_TOKEN</code>, 
 
306
<code>MULTIEXCEPT_TOKEN</code>, <code>MULTIINSIDE_TOKEN</code>, 
 
307
<code>CREATURE_TOKEN</code> and <code>NUMBER_TOKEN</code>. Alternatively, 
 
308
<code>tokentype</code> can be <code>SCOPE_TT</code> and <code>tokendata</code> 
 
309
must then be a &#8220;scope routine&#8221;.<br>
 
310
<i>Routine returns</i> &nbsp; <code>GPR_FAIL</code> if 
 
311
parsing fails; <code>GPR_PREPOSITION</code> if a match is made but results 
 
312
in no data; <code>GPR_NUMBER</code> if a match is made, resulting in 
 
313
a number; <code>GPR_MULTIPLE</code> if a match is made, resulting in 
 
314
a multiple object; <code>GPR_REPARSE</code> if the parser has had to
 
315
rewrite the text being parsed and would now like parsing to begin again 
 
316
from scratch; otherwise, an object which the parser has matched against 
 
317
the text.</p>
 
318
 
 
319
<p class="lynxonly"></p>
 
320
<table class="sa2">
 
321
<tr class="r1"><td class="c1"><code>PlaceInScope(obj)</code> &nbsp;</td>
 
322
<td class="c2"><i>see</i> <a href="s32.html">&#167;32</a></td></tr>
 
323
</table>
 
324
<p class="normal">Used in &#8220;scope routines&#8221; (only) when 
 
325
<code>scope_stage</code> is set to 2 (only). Places <code>obj</code> in 
 
326
scope for the token currently being parsed. No other objects are placed 
 
327
in scope as a result of this, unlike the case of <code>ScopeWithin</code>.<br>
 
328
<i>No return value</i></p>
 
329
 
 
330
<p class="lynxonly"></p>
 
331
<table class="sa2">
 
332
<tr class="r1"><td class="c1"><code>PlayerTo(obj,flag)</code> &nbsp;</td>
 
333
<td class="c2"><i>see</i> <a href="s21.html">&#167;21</a></td></tr>
 
334
</table>
 
335
<p class="normal">Moves the player to <code>obj</code>, which can either 
 
336
be a location or something <code>enterable</code>. If <code>flag</code> 
 
337
is <code>false</code>, then run a <code>Look</code> action to print 
 
338
out a room description: but if <code>flag</code> is <code>true</code>, 
 
339
print nothing, and if <code>flag</code> is 2, print a room description 
 
340
but abbreviate it if the room has been visited before.<br>
 
341
<i>No return value</i></p>
 
342
 
 
343
<p class="lynxonly"></p>
 
344
<a id="p433" name="p433"></a>
 
345
<table class="sa2">
 
346
<tr class="r1"><td class="c1"><code>PronounNotice(obj)</code> &nbsp;</td>
 
347
<td class="c2"><i>see</i> <a href="s33.html">&#167;33</a></td></tr>
 
348
</table>
 
349
<p class="normal">Resets the pronouns to the object <code>obj</code>. 
 
350
This means that all pronouns which can match against the object are 
 
351
set equal to it: for instance, &#8220;Aunt Jemima&#8221; would match 
 
352
<code>'her'</code> but not <code>'it'</code>, &#8220;the grapes&#8221; 
 
353
would match <code>'them'</code> and so on.<br>
 
354
<i>No return value</i></p>
 
355
 
 
356
<p class="lynxonly"></p>
 
357
<table class="sa2">
 
358
<tr class="r1"><td class="c1"><code>PronounValue(pronoun)</code> &nbsp;</td>
 
359
<td class="c2"><i>see</i> <a href="s33.html">&#167;33</a></td></tr>
 
360
</table>
 
361
<p class="normal">Finds the current setting of <code>pronoun</code>, which 
 
362
has to be the dictionary value of a legal pronoun in the current language: 
 
363
in the case of English, that means <code>'it'</code>, <code>'him'</code>, 
 
364
<code>'her'</code> or <code>'them'</code>.<br>
 
365
<i>Routine returns</i> &nbsp; The setting, or 
 
366
<code>nothing</code> if it is unset.</p>
 
367
 
 
368
<p class="lynxonly"></p>
 
369
<table class="sa2">
 
370
<tr class="r1"><td class="c1"><code>ScopeWithin(obj)</code> &nbsp;</td>
 
371
<td class="c2"><i>see</i> <a href="s32.html">&#167;32</a></td></tr>
 
372
</table>
 
373
<p class="normal">Used in &#8220;scope routines&#8221; (only) when 
 
374
<code>scope_stage</code> is set to 2 (only). Places the contents 
 
375
of <code>obj</code> in scope for the token currently being parsed, 
 
376
and applies the rules of scope recursively so that contents of see-through 
 
377
objects are also in scope, as is anything added to scope.<br>
 
378
<i>No return value</i></p>
 
379
 
 
380
<p class="lynxonly"></p>
 
381
<table class="sa2">
 
382
<tr class="r1"><td class="c1"><code>SetPronoun(pronoun,obj)</code> &nbsp;</td>
 
383
<td class="c2"><i>see</i> <a href="s33.html">&#167;33</a></td></tr>
 
384
</table>
 
385
<p class="normal">Changes the current setting of <code>pronoun</code>, 
 
386
which has to be the dictionary value of a legal pronoun in the current 
 
387
language: in the case of English, that means <code>'it'</code>, 
 
388
<code>'him'</code>, <code>'her'</code> or <code>'them'</code>.<br>
 
389
<i>No return value</i></p>
 
390
 
 
391
<p class="lynxonly"></p>
 
392
<table class="sa2">
 
393
<tr class="r1"><td class="c1"><code>SetTime(time,rate)</code> &nbsp;</td>
 
394
<td class="c2"><i>see</i> <a href="s20.html">&#167;20</a></td></tr>
 
395
</table>
 
396
<p class="normal">Set the game clock (a 24-hour clock) to the given 
 
397
<code>time</code> (in seconds since the start of the day), to run 
 
398
at the given rate <i>r</i>: <i>r</i> = 0 means it does not run, if 
 
399
<i>r</i> &gt; 0 then <i>r</i> seconds pass every turn, if <i>r</i> &lt; 
 
400
0 then &#8722;<i>r</i> turns pass every second.<br>
 
401
<i>No return value</i></p>
 
402
 
 
403
<p class="lynxonly"></p>
 
404
<table class="sa2">
 
405
<tr class="r1"><td class="c1"><code>StartDaemon(obj)</code> &nbsp;</td>
 
406
<td class="c2"><i>see</i> <a href="s20.html">&#167;20</a></td></tr>
 
407
</table>
 
408
<p class="normal">Makes the daemon of the object <code>obj</code> active, 
 
409
so that its <code>daemon</code> routine will be called at the end 
 
410
of every turn.<br>
 
411
<i>No return value</i></p>
 
412
 
 
413
<p class="lynxonly"></p>
 
414
<table class="sa2">
 
415
<tr class="r1"><td class="c1"><code>StartTimer(obj,period)</code> &nbsp;</td>
 
416
<td class="c2"><i>see</i> <a href="s20.html">&#167;20</a></td></tr>
 
417
</table>
 
418
<p class="normal">Makes the timer of the object <code>obj</code> active. 
 
419
Its <code>time_left</code> property is set initially to <code>period</code>, 
 
420
then decreased by 1 at the end of every turn in which it was positive. 
 
421
At the end of the turn when it was zero, the timer is stopped and 
 
422
the object's <code>time_out</code> property is called.<br>
 
423
<i>No return value</i></p>
 
424
 
 
425
<p class="lynxonly"></p>
 
426
<a id="p434" name="p434"></a>
 
427
<table class="sa2">
 
428
<tr class="r1"><td class="c1"><code>StopDaemon(obj)</code> &nbsp;</td>
 
429
<td class="c2"><i>see</i> <a href="s20.html">&#167;20</a></td></tr>
 
430
</table>
 
431
<p class="normal">Makes the daemon of the object <code>obj</code> no 
 
432
longer active, so that its <code>daemon</code> routine will no
 
433
longer be called at the end of every turn.<br>
 
434
<i>No return value</i></p>
 
435
 
 
436
<p class="lynxonly"></p>
 
437
<table class="sa2">
 
438
<tr class="r1"><td class="c1"><code>StopTimer(obj)</code> &nbsp;</td>
 
439
<td class="c2"><i>see</i> <a href="s20.html">&#167;20</a></td></tr>
 
440
</table>
 
441
<p class="normal">Makes the timer of the object <code>obj</code> no 
 
442
longer active, so that its <code>time_left</code> routine will no 
 
443
longer be decreased and <code>time_out</code> will not be called 
 
444
as originally scheduled.<br>
 
445
<i>No return value</i></p>
 
446
 
 
447
<p class="lynxonly"></p>
 
448
<table class="sa2">
 
449
<tr class="r1"><td class="c1"><code>TestScope(obj,actor)</code> &nbsp;</td>
 
450
<td class="c2"><i>see</i> <a href="s32.html">&#167;32</a></td></tr>
 
451
</table>
 
452
<p class="normal">Tests whether the object <code>obj</code> is in scope 
 
453
to the given <code>actor</code>. If no <code>actor</code> is given, 
 
454
the actor is assumed to be the player.<br>
 
455
<i>Routine returns</i> &nbsp; <code>true</code> or 
 
456
<code>false</code>.</p>
 
457
 
 
458
<p class="lynxonly"></p>
 
459
<table class="sa2">
 
460
<tr class="r1"><td class="c1"><code>TryNumber(wordnum)</code> &nbsp;</td>
 
461
<td class="c2"><i>see</i> <a href="s28.html">&#167;28</a></td></tr>
 
462
</table>
 
463
<p class="normal">Tries to parse the word at <code>wordnum</code> as 
 
464
a non-negative number, recognising decimal numbers and English ones 
 
465
from &#8220;one&#8221; to &#8220;twenty&#8221;.<br>
 
466
<i>Routine returns</i> &nbsp; &#8722;1000 if it fails 
 
467
altogether, or the number, except that values exceeding 10000 are rounded 
 
468
down to 10000.</p>
 
469
 
 
470
<p class="lynxonly"></p>
 
471
<table class="sa2">
 
472
<tr class="r1"><td class="c1"><code>UnsignedCompare(a,b)</code></td>
 
473
</tr></table>
 
474
<p class="normal">The usual <code>&gt;</code> condition performs 
 
475
a signed comparison, and occasionally, usually when comparing addresses 
 
476
in memory of routines or strings, you need an unsigned comparison.<br>
 
477
<i>Routine returns</i> &nbsp; Returns 1 if <i>a</i> 
 
478
&gt; <i>b</i>, 0 if <i>a</i> = <i>b</i> and &#8722;1 if <i>a</i> &lt; 
 
479
<i>b</i>, regarding <i>a</i> and <i>b</i> as unsigned numbers between 
 
480
0 and 65535. (That is, regarding <code>-1</code> as 65535, <code>-2</code> 
 
481
as 65534, &#8230;, <code>-32768</code> as 32768.)</p>
 
482
 
 
483
<p class="lynxonly"></p>
 
484
<table class="sa2">
 
485
<tr class="r1"><td class="c1"><code>WordAddress(wordnum)</code> &nbsp;</td>
 
486
<td class="c2"><i>see</i> <a href="s28.html">&#167;28</a></td></tr>
 
487
</table>
 
488
<p class="normal">Find where word number <code>wordnum</code> from what 
 
489
the player typed is stored.<br>
 
490
<i>Routine returns</i> &nbsp; The <code>-&gt;</code> 
 
491
array holding the text of the word.</p>
 
492
 
 
493
<p class="lynxonly"></p>
 
494
<table class="sa2">
 
495
<tr class="r1"><td class="c1"><code>WordInProperty(word,obj,prop)</code> &nbsp;</td>
 
496
<td class="c2"><i>see</i> <a href="s34.html">&#167;34</a></td></tr>
 
497
</table>
 
498
<p class="normal">Tests whether <code>word</code> is one of the dictionary 
 
499
values listed in the array given as the property <code>prop</code> of object 
 
500
<code>obj</code>. (Most often used to see if a given dictionary word is 
 
501
one of the <code>name</code> values.)<br>
 
502
<i>Routine returns</i> &nbsp; <code>true</code> or <code>false</code>.</p>
 
503
 
 
504
<p class="lynxonly"></p>
 
505
<a id="p435" name="p435"></a>
 
506
<table class="sa2">
 
507
<tr class="r1"><td class="c1"><code>WordLength(wordnum)</code> &nbsp;</td>
 
508
<td class="c2"><i>see</i> <a href="s28.html">&#167;28</a></td></tr>
 
509
</table>
 
510
<p class="normal">Find the length (number of letters) of the word 
 
511
numbered <code>wordnum</code> from what the player typed.<br>
 
512
<i>Routine returns</i> &nbsp; The length.</p>
 
513
 
 
514
<p class="lynxonly"></p>
 
515
<table class="sa2">
 
516
<tr class="r1"><td class="c1"><code>WriteListFrom(obj,st)</code> &nbsp;</td>
 
517
<td class="c2"><i>see</i> <a href="s27.html">&#167;27</a></td></tr>
 
518
</table>
 
519
<p class="normal">Write a list of <code>obj</code> and its siblings, 
 
520
with the style being <code>st</code>. To list all the objects inside
 
521
<code>X</code>, list from <code>child(X)</code>. The style is made 
 
522
up by adding together some of the following constants:</p>
 
523
<p class="lynxonly"></p>
 
524
<div class="inset"><table>
 
525
<tr><td><code>NEWLINE_BIT</code></td><td>New-line after each entry</td></tr>
 
526
<tr><td><code>INDENT_BIT</code></td><td>Indent each entry according to depth</td></tr>
 
527
<tr><td><code>FULLINV_BIT</code></td><td>Full inventory information after entry</td></tr>
 
528
<tr><td><code>ENGLISH_BIT</code></td><td>English sentence style, with commas and &#8216;and&#8217;</td></tr>
 
529
<tr><td><code>RECURSE_BIT</code></td><td>Recurse downwards with usual rules</td></tr>
 
530
<tr><td><code>ALWAYS_BIT</code></td><td>Always recurse downwards</td></tr>
 
531
<tr><td><code>TERSE_BIT</code></td><td>More terse English style</td></tr>
 
532
<tr><td><code>PARTINV_BIT</code></td><td>Only brief inventory information after entry</td></tr>
 
533
<tr><td><code>DEFART_BIT</code></td><td>Use the definite article in list</td></tr>
 
534
<tr><td><code>WORKFLAG_BIT</code></td><td>At top level (only), only list objects which have the <code>workflag</code> attribute</td></tr>
 
535
<tr><td><code>ISARE_BIT</code></td><td>Prints &#8220; is &quot; or &#8220; are &quot; before list</td></tr>
 
536
<tr><td><code>CONCEAL_BIT</code></td><td>Misses out <code>concealed</code> or <code>scenery</code> objects</td></tr>
 
537
</table></div>
 
538
 
 
539
<p class="lynxonly"></p>
 
540
<table class="sa2">
 
541
<tr class="r1"><td class="c1"><code>YesOrNo()</code></td>
 
542
</tr></table>
 
543
<p class="normal" style="margin-bottom:1em">Assuming that a question has already been printed, 
 
544
wait for the player to type &#8220;yes&#8221;, &#8220;y&#8221;, &#8220;no&#8221; 
 
545
or &#8220;n&#8221;.<br>
 
546
<i>Routine returns</i> &nbsp; <code>true</code> 
 
547
for &#8220;yes&#8221; or &#8220;y&#8221;, <code>false</code> for 
 
548
&#8220;no&#8221; or &#8220;n&#8221;.</p>
 
549
 
 
550
</div>
 
551
<p class="navbar">
 
552
 <a href="index.html">home</a> /
 
553
 <a href="contents.html">contents</a> /
 
554
 <a href="app.html">appendices</a> /
 
555
 <a href="sa2.html" title="&#167;A2: Library properties">prev</a> /
 
556
 <a href="sa4.html" title="&#167;A4: Library message numbers">next</a> /
 
557
 <a href="dm4index.html">index</a>
 
558
</p>
 
559
</body>
 
560
</html>
 
561