1
<HTML><HEAD><TITLE>Section A6: Library properties</TITLE></HEAD>
2
<BODY BGCOLOR="#FFFFFF">
4
<TR><TD Valign="top"><A HREF="contents.html">Contents</A><BR><A HREF="sectionA5.html">Back</A><BR><A HREF="sectionA7.html">Forward</A><TD bgcolor="#F5DEB3"><BLOCKQUOTE><H3>A6. Library properties</H3></BLOCKQUOTE><TR><TD><TD>
6
The following table lists every library-defined property. The banner
7
headings give the name, what type of value makes sense and the default value
8
(if other than 0). The symbol
10
means "this property is additive''
11
so that inherited values from class definitions pile up into a list, rather
12
than wipe each other out. Recall that 'false' is the value 0 and 'true'
16
<P><TR><TD><TD bgcolor="#AE9BFF"><TT><B>n_to, s_to, e_to, w_to, ...</B></TT> -- Room, object or routine<TR><TD><TD>
17
<BR><I>For rooms: </I>These twelve properties (there are also <TT>ne_to</TT>, <TT>nw_to</TT>, <TT>se_to</TT>,
18
<TT>sw_to</TT>, <TT>in_to</TT>, <TT>out_to</TT>, <TT>u_to</TT> and <TT>d_to</TT>) are the map connections for
19
the room. A value of 0 means "can't go this way''. Otherwise, the
20
value should either be a room or a <TT>door</TT> object: thus, <TT>e_to</TT> might be set
21
to <TT>crystal_bridge</TT> if the direction "east'' means "over the crystal
25
<BR><I>Routine should return:</I> The room or object the map connects to; or 0 for "can't go this way'';
26
or 1 for "can't go this way; stop and print nothing further''.
29
<BR><I>Warning: </I> Do not confuse the direction properties <TT>n_to</TT> and so on with
30
the twelve direction objects, <TT>n_obj</TT> et
34
<P><TR><TD><TD bgcolor="#AE9BFF"><TT><B>add_to_scope</B></TT> -- List of objects or routine<TR><TD><TD>
35
<BR><I>For objects: </I>When this object is in scope, so are all those listed, or all those
36
nominated by the routine. A routine given here should call
37
<TT>PlaceInScope(obj)</TT> to put <TT>obj</TT> in scope.
40
<BR><I>No return value expected from routine.</I>
43
<P><TR><TD Valign="top"><B>(+)</B><TD bgcolor="#AE9BFF"><TT><B>after</B></TT> -- Routine (<TT>NULL</TT>)<TR><TD><TD>
44
Receives actions after they have happened, but before the player has
48
<BR><I>For rooms: </I>All actions taking place in this room.
51
<BR><I>For objects: </I>All actions for which this object is <TT>noun</TT> (the first object
52
specified in the command); and all fake actions for it.
55
<BR><I>Routine should return:</I> False to continue (and tell the player what has happened), true to
56
stop here (printing nothing).
59
The <TT>Search</TT> action is a slightly special case. Here, <TT>after</TT> is
60
called when it is clear that it would be sensible to look inside the object
61
(e.g., it's an open container in a light room) but before the contents
65
<P><TR><TD><TD bgcolor="#AE9BFF"><TT><B>article</B></TT> -- String or routine (<TT>"a"</TT>)<TR><TD><TD>
66
<BR><I>For objects: </I>Indefinite article for object or routine to print one.
69
<BR><I>No return value expected from routine.</I>
72
<P><TR><TD><TD bgcolor="#AE9BFF"><TT><B>articles</B></TT> -- Array of strings<TR><TD><TD>
73
For objects: If given, these are the articles used with
74
the object's name. (Provided for non-English languages
75
where irregular nouns may have unusual vowel-contraction
76
rules with articles: e.g. with French non-mute 'H'.)
79
<P><TR><TD Valign="top"><B>(+)</B><TD bgcolor="#AE9BFF"><TT><B>before</B></TT> -- Routine (<TT>NULL</TT>)<TR><TD><TD>
80
Receives advance warning of actions (or fake actions) about to happen.
83
<BR><I>For rooms: </I>All actions taking place in this room.
86
<BR><I>For objects: </I>All actions for which this object is <TT>noun</TT> (the first object
87
specified in the command); and all fake actions, such as <TT>Receive</TT>
88
and <TT>LetGo</TT> if this object is the container or supporter concerned.
91
<BR><I>Routine should return:</I> False to continue with the action, true to stop here (printing
95
First special case: A vehicle object receives the <TT>Go</TT>
96
action if the player is trying to drive around in it. In this case:
99
<BR><I>Routine should return:</I> 0 to disallow as usual; 1 to allow as usual, moving vehicle and
100
player; 2 to disallow but do (and print) nothing; 3 to allow but do
101
(and print) nothing. If you want to move the vehicle in your own code,
102
return 3, not 2: otherwise the old location may be restored by subsequent
106
Second special case: in a <TT>PushDir</TT> action, the <TT>before</TT>
107
routine must call <TT>AllowPushDir()</TT> and then return true in order to
108
allow the attempt (to push an object from one room to another) to
112
<P><TR><TD><TD bgcolor="#AE9BFF"><TT><B>cant_go</B></TT> -- String or routine (<TT>"You can't go that way."</TT>)<TR><TD><TD>
113
<BR><I>For rooms: </I>Message, or routine to print one, when a player tries to go in an
114
impossible direction from this room.
117
<BR><I>No return value expected from routine.</I>
120
<P><TR><TD><TD bgcolor="#AE9BFF"><TT><B>capacity</B></TT> -- Number or routine (<TT>100</TT>)<TR><TD><TD>
121
<BR><I>For objects: </I>Number of objects a <TT>container</TT> or <TT>supporter</TT>
125
<BR><I>For player objects: </I>Number of things the player can carry (when the player is this
126
object); the default player object (<TT>selfobj</TT>) has <TT>capacity</TT> initially
127
set to the constant <TT>MAX_CARRIED</TT>.
130
<P><TR><TD><TD bgcolor="#AE9BFF"><TT><B>daemon</B></TT> -- Routine (<TT>NULL</TT>)<TR><TD><TD>
131
This routine is run each turn, once it has been activated by a
132
call to <TT>StartDaemon</TT>, and until stopped by a call to <TT>StopDaemon</TT>.
135
<P><TR><TD Valign="top"><B>(+)</B><TD bgcolor="#AE9BFF"><TT><B>describe</B></TT> -- Routine (<TT>NULL</TT>)<TR><TD><TD>
136
<BR><I>For objects: </I>Called when the object is to be described in a room description,
137
before any paragraph break (i.e., skipped line) has been printed. A
138
sometimes useful trick is to print nothing in this routine and return
139
true, which makes an object 'invisible'.
142
<BR><I>For rooms: </I>Called before a room's long ("look'') description is printed.
145
<BR><I>Routine should return:</I> False to describe in the usual way, true to stop printing here.
148
<P><TR><TD><TD bgcolor="#AE9BFF"><TT><B>description</B></TT> -- String or routine<TR><TD><TD>
149
<BR><I>For objects: </I>The <TT>Examine</TT> message, or a routine to print one out.
152
<BR><I>For rooms: </I>The long ("look'') description, or a routine to print one out.
155
<BR><I>No return value expected from routine.</I>
158
<P><TR><TD><TD bgcolor="#AE9BFF"><TT><B>door_dir</B></TT> -- Direction property or routine<TR><TD><TD>
159
<BR><I>For compass objects: </I>When the player tries to go in this direction, e.g., by typing the
160
name of this object, then the map connection tried is the value of
161
this direction property for the current room. For example, the
162
<TT>n_obj</TT> "north'' object normally has <TT>door_dir</TT> set to <TT>n_to</TT>.
165
<BR><I>For objects: </I>The direction that this <TT>door</TT> object goes via (for instance,
166
a bridge might run east, in which case this would be set to <TT>e_to</TT>).
169
<BR><I>Routine should return:</I> The direction property to try.
172
<P><TR><TD><TD bgcolor="#AE9BFF"><TT><B>door_to</B></TT> -- Room or routine<TR><TD><TD>
173
<BR><I>For objects: </I>The place this door object leads to. A value of 0 means
177
<BR><I>Routine should return:</I> The room. Again, 0 (or false) means "leads nowhere''.
178
Further, 1 (or true) means "stop the movement action immediately
179
and print nothing further''.
182
<P><TR><TD Valign="top"><B>(+)</B><TD bgcolor="#AE9BFF"><TT><B>each_turn</B></TT> -- String or routine (<TT>NULL</TT>)<TR><TD><TD>
183
String to print, or routine to run, at the end of each turn in which
184
the object is in scope (after all timers and daemons for that turn have
188
<BR><I>No return value expected from routine.</I>
191
<P><TR><TD><TD bgcolor="#AE9BFF"><TT><B>found_in</B></TT> -- List of rooms or routine<TR><TD><TD>
192
This object will be found in all of the listed rooms, or if
193
the routine says so, unless it has the attribute <TT>absent</TT>. If
194
an object in the list is not a room, it means "present in the
195
same room as this object''.
198
<BR><I>Routine should return:</I> True to be present, otherwise false. The routine can look
199
at the current <TT>location</TT> in order to decide.
202
<BR><I>Warning: </I>This property is only looked at when the player changes rooms.
205
<P><TR><TD><TD bgcolor="#AE9BFF"><TT><B>grammar</B></TT> -- Routine<TR><TD><TD>
206
<BR><I>For animate or talkable objects: </I> This is called when the
207
parser has worked out that the object in question is being spoken
208
to, and has decided the <TT>verb_word</TT> and <TT>verb_wordnum</TT> (the position
209
of the verb word in the word stream) but hasn't yet tried any grammar.
210
The routine can, if it wishes, parse past some words (provided it
211
moves <TT>verb_wordnum</TT> on by the number of words it wants to eat up).
214
<BR><I>Routine should return:</I> False to carry on as usual; true to indicate that the routine
215
has parsed the entire command itself, and set up <TT>action</TT>, <TT>noun</TT>
216
and <TT>second</TT> to the appropriate order; or a dictionary value for
217
a verb, such as <TT>'take'</TT>, to indicate "parse the command from this
218
verb's grammar instead''; or minus such a value, e.g. <TT>-'take'</TT>,
219
to indicate "parse from this verb and then parse the usual
223
<P><TR><TD><TD bgcolor="#AE9BFF"><TT><B>initial</B></TT> -- String or routine<TR><TD><TD>
224
<BR><I>For objects: </I>The description of an object not yet picked up, used when a
225
room is described; or a routine to print one out.
228
<BR><I>For rooms: </I>Printed or run when the room is arrived in, either by ordinary
229
movement or by <TT>PlayerTo</TT>.
232
<BR><I>Warning: </I>If the object is a <TT>door</TT>, or a <TT>container</TT>, or is <TT>switchable</TT>,
233
then use one of the <TT>when_</TT> properties rather than <TT>initial</TT>.
236
<BR><I>No return value expected from routine.</I>
239
<P><TR><TD><TD bgcolor="#AE9BFF"><TT><B>inside_description</B></TT> -- String or routine<TR><TD><TD>
240
<BR><I>For objects: </I>Printed as part or all of a room description when the player is
241
inside the given object, which must be <TT>enterable</TT>.
244
<P><TR><TD><TD bgcolor="#AE9BFF"><TT><B>invent</B></TT> -- Routine<TR><TD><TD>
245
This routine is for changing an object's inventory listing. If provided,
246
it's called twice, first with the variable <TT>inventory_stage</TT> set to 1,
247
second with it set to 2. At stage 1, you have an entirely free hand to
248
print a different inventory listing.
251
<BR><I>Routine should return:</I> Stage 1: False to continue; true to stop here, printing nothing further
252
about the object or its contents.
255
At stage 2, the object's indefinite article and short name have
256
already been printed, but messages like " (providing light)'' haven't.
257
This is an opportunity to add something like " (almost empty)".
260
<BR><I>Routine should return:</I> Stage 2: False to continue; true to stop here, printing nothing further
261
about the object or its contents.
264
<P><TR><TD Valign="top"><B>(+)</B><TD bgcolor="#AE9BFF"><TT><B>life</B></TT> -- Routine (<TT>NULL</TT>)<TR><TD><TD>
265
This routine holds rules about <TT>animate</TT> objects, behaving much like
266
<TT>before</TT> and <TT>after</TT> but only handling the person-to-person events:
268
Attack Kiss WakeOther ThrowAt Give Show Ask Tell Answer Order
271
See <A HREF="section16.html">Section 16</A>, and see also the properties <TT>orders</TT> and <TT>grammar</TT>.
274
<BR><I>Routine should return:</I> True to stop and print nothing, false to resume as usual (for example,
275
printing "Miss Gatsby has better things to do.'').
278
<P><TR><TD><TD bgcolor="#AE9BFF"><TT><B>list_together</B></TT> -- Number, string or routine<TR><TD><TD>
280
Objects with the same <TT>list_together</TT> value are grouped together in
281
object lists (such as inventories, or the miscellany at the end of a
282
room description). If a string such as <TT>"fish"</TT> is given, then such
283
a group will be headed with text such as <TT>"five fish"</TT>.
286
A routine, if given, is called at two stages in the process
287
(once with the variable <TT>inventory_stage</TT> set to 1, once with it set to 2).
288
These stages occur before and after the group is printed; thus, a
289
preamble or postscript can be printed. Also, such a routine may
290
change the variable <TT>c_style</TT> (which holds the current list style).
291
On entry, the variable <TT>parser_one</TT> holds the first object in the
292
group, and <TT>parser_two</TT> the current depth of recursion in the list.
293
Applying <TT>x=NextEntry(x,parser_two);</TT> moves <TT>x</TT> on from <TT>parser_one</TT>
294
to the next item in the group. Another helpful variable is
295
<TT>listing_together</TT>, set up to the first object of a group being listed
296
(or to 0 whenever no group is being listed).
299
<BR><I>Routine should return:</I> Stage 1: False to continue, true not to print the group's list
303
<BR><I>Routine should return:</I> Stage 2: No return value.
306
<P><TR><TD><TD bgcolor="#AE9BFF"><TT><B>orders</B></TT> -- Routine<TR><TD><TD>
307
<BR><I>For animate or talkable objects: </I> This carries out the player's
308
orders (or doesn't, as it sees fit): it looks at <TT>actor</TT>, <TT>action</TT>,
309
<TT>noun</TT> and <TT>second</TT> to do so. Unless this object is the current
310
player, <TT>actor</TT> is irrelevant (it is always the player) and the
311
object is the person being ordered about.
314
If the player typed an incomprehensible command, like
315
"robot, og sthou'', then the action is <TT>NotUnderstood</TT> and the
316
variable <TT>etype</TT> holds the parser's error number.
319
If this object is the current player then <TT>actor</TT> is
320
the person being ordered about. <TT>actor</TT> can either be this
321
object -- in which case an action is being processed, because
322
the player has typed an ordinary command -- or can be some other
323
object, in which case the player has typed an order. See
324
<A HREF="section16.html">Section 16</A> for how to write <TT>orders</TT> routines in these cases.
327
<BR><I>Routine should return:</I> True to stop and print nothing further; false to continue.
328
(Unless the object is the current player, the <TT>life</TT> routine's
329
<TT>Order</TT> section gets an opportunity to meddle next; after that,
333
<P><TR><TD Valign="top"><B>(+)</B><TD bgcolor="#AE9BFF"><TT><B>name</B></TT> -- List of dictionary words<TR><TD><TD>
334
<BR><I>For objects: </I>A list of dictionary words referring to this object.
337
<BR><I>Warning: </I>The <TT>parse_name</TT> property of an object may take precedence over this,
341
<BR><I>For rooms: </I>A list of words which the room understands but which refer to things
342
which "do not need to be referred to in this game''; these are only looked
343
at if all other attempts to understand the player's command have failed.
346
<BR><I>Warning: </I>Uniquely in Inform syntax, these dictionary words are given in double
347
quotes <TT>"thus"</TT>, whereas in all other circumstances they would be <TT>'thus'</TT>.
348
This means they can safely be only one letter long without ambiguity.
351
<P><TR><TD><TD bgcolor="#AE9BFF"><TT><B>number</B></TT> -- Any value<TR><TD><TD>
352
A general purpose property left free: conventionally holding a number like
353
"number of turns' battery power left''.
356
<BR><I>For compass objects: </I>Note that the standard compass objects defined by the library all
357
provide a <TT>number</TT> property, in case this might be useful to the designer.
360
<BR><I>For player objects: </I>Exception: an object to be used as a player-object must provide one of
361
these, and musn't use it for anything.
364
<P><TR><TD><TD bgcolor="#AE9BFF"><TT><B>parse_name</B></TT> -- Routine<TR><TD><TD>
365
<BR><I>For objects: </I>To parse an object's name (this overrides the <TT>name</TT> but is also used in
366
determining if two objects are describably identical). This routine should
367
try to match as many words as possible in sequence, reading them one at a
368
time by calling <TT>NextWord()</TT>. (It can leave the "word marker'' variable
369
<TT>wn</TT> anywhere it likes).
372
<BR><I>Routine should return:</I> 0 if the text didn't make any sense at all, -1 to make the parser resume
373
its usual course (looking at the <TT>name</TT>), or the number of words in a row
374
which successfully matched.
377
In addition to this, if the text matched seems to be in the plural
378
(for instance, a blind mouse object reading <TT>blind mice</TT>), the routine can
379
set the variable <TT>parser_action</TT> to the value <TT>##PluralFound</TT>. The parser
380
will then match with all of the different objects understood, rather than
381
ask a player which of them is meant.
384
A <TT>parse_name</TT> routine may also (voluntarily) assist the parser
385
by telling it whether or not two objects which share the same <TT>parse_name</TT>
386
routine are identical. (They may share the same routine if they both inherit
387
it from a class.) If, when it is called, the variable <TT>parser_action</TT> is
388
set to <TT>##TheSame</TT> then this is the reason. It can then decide whether or
389
not the objects <TT>parser_one</TT> and <TT>parser_two</TT> are indistinguishable.
392
<BR><I>Routine should return:</I> -1 if the objects are indistinguishable, -2 if not.
395
<P><TR><TD><TD bgcolor="#AE9BFF"><TT><B>plural</B></TT> -- String or routine<TR><TD><TD>
396
<BR><I>For objects: </I>The plural name of an object (when in the presence of others like it),
397
or routine to print one; for instance, a wax candle might have <TT>plural</TT> set
398
to <TT>"wax candles"</TT>.
401
<BR><I>No return value expected from routine.</I>
404
<P><TR><TD><TD bgcolor="#AE9BFF"><TT><B>react_after</B></TT> -- Routine<TR><TD><TD>
405
<BR><I>For objects: </I>Acts like an <TT>after</TT> rule, but detects any actions in the vicinity
406
(any actions which take place when this object is in scope).
409
<BR><I>Routine should return:</I> True to print nothing further; false to carry on.
412
<P><TR><TD><TD bgcolor="#AE9BFF"><TT><B>react_before</B></TT> -- Routine<TR><TD><TD>
413
<BR><I>For objects: </I>Acts like a <TT>before</TT> rule, but detects any actions in the vicinity
414
(any actions which take place when this object is in scope).
417
<BR><I>Routine should return:</I> True to stop the action, printing nothing; false to carry on.
420
<P><TR><TD><TD bgcolor="#AE9BFF"><TT><B>short_name</B></TT> -- Routine<TR><TD><TD>
421
<BR><I>For objects: </I>The short name of an object (like "brass lamp"), or a routine to print
425
<BR><I>Routine should return:</I> True to stop here, false to carry on by printing the object's 'real'
426
short name (the string given at the head of the object's definition). It's
427
sometimes useful to print text like <TT>"half-empty "</TT> and then return false.
430
<P><TR><TD><TD bgcolor="#AE9BFF"><TT><B>short_name_indef</B></TT> -- Routine<TR><TD><TD>
431
<BR><I>For objects: </I>If set, this form of the short name is used
432
when the name is prefaced by an indefinite article. (This
433
is not useful in English-language games, but in other
434
languages adjectival parts of names agree with the
435
definiteness of the article.)
438
<P><TR><TD><TD bgcolor="#AE9BFF"><TT><B>time_left</B></TT> -- Number<TR><TD><TD>
439
Number of turns left until the timer for this object (if set, which must be
440
done using <TT>StartTimer</TT>) goes off. Its initial value is of no significance,
441
as <TT>StartTimer</TT> will write over this, but a timer object must provide the
442
property. If the timer is currently set, the value 0 means "will go off
443
at the end of the current turn'', the value 1 means "...at the end of
444
next turn'' and so on.
447
<P><TR><TD><TD bgcolor="#AE9BFF"><TT><B>time_out</B></TT> -- Routine (<TT>NULL</TT>)<TR><TD><TD>
448
Routine to run when the timer for this object goes off (having been set by
449
<TT>StartTimer</TT> and not in the mean time stopped by <TT>StopTimer</TT>).
452
<BR><I>Warning: </I>A timer object must also provide a <TT>time_left</TT> property.
455
<P><TR><TD><TD bgcolor="#AE9BFF"><TT><B>when_closed</B></TT> -- String or routine<TR><TD><TD>
456
<BR><I>For objects: </I>Description, or routine to print one, of something closed (a <TT>door</TT> or
457
<TT>container</TT>) in a room's long description.
460
<BR><I>No return value expected from routine.</I>
463
<P><TR><TD><TD bgcolor="#AE9BFF"><TT><B>when_open</B></TT> -- String or routine<TR><TD><TD>
464
<BR><I>For objects: </I>Description, or routine to print one, of something open (a <TT>door</TT> or
465
<TT>container</TT>) in a room's long description.
468
<BR><I>No return value expected from routine.</I>
471
<P><TR><TD><TD bgcolor="#AE9BFF"><TT><B>when_on</B></TT> -- String or routine<TR><TD><TD>
472
<BR><I>For objects: </I>Description, or routine to print one, of a <TT>switchable</TT> object which is
473
currently switched on, in a room's long description.
476
<BR><I>No return value expected from routine.</I>
479
<P><TR><TD><TD bgcolor="#AE9BFF"><TT><B>when_off</B></TT> -- String or routine<TR><TD><TD>
480
<BR><I>For objects: </I>Description, or routine to print one, of a <TT>switchable</TT> object which is
481
currently switched off, in a room's long description.
484
<BR><I>No return value expected from routine.</I>
487
<P><TR><TD><TD bgcolor="#AE9BFF"><TT><B>with_key</B></TT> -- Object (<TT>nothing</TT>)<TR><TD><TD>
488
The key object needed to lock or unlock this <TT>lockable</TT> object. A player
489
must explicitly name it as the key being used and be holding it at the time.
490
The value <TT>nothing</TT>, or 0, means that no key fits (though this is not made
491
clear to the player, who can try as many as he likes).
493
<HR><A HREF="contents.html">Contents</A> / <A HREF="sectionA5.html">Back</A> / <A HREF="sectionA7.html">Forward</A> <BR>
494
<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>