Minor fixes for LaTeX build.
[ibg.git] / appendices / f.rst
1 ==============================
2  Appendix F -- Inform library
3 ==============================
4
5 .. |ADD| replace:: **+**
6
7 .. The ⊕ symbol doesn't work in LaTeX.
8
9 .. default-role:: samp
10
11 .. only:: html
12
13    .. image:: /images/picL.png
14       :align: left
15
16 .. raw:: latex
17
18    \dropcap{l}
19
20 ibrary files define Inform's model world, turning a conventional
21 programming language into a text adventure development system.  Here are
22 the library constants, variables and routines, the standard object
23 properties and attributes, the verb grammars and actions.
24
25 Library objects
26 ===============
27
28 `compass`
29   A `container` object holding the twelve direction objects `d_obj e_obj
30   in_obj n_obj ne_obj nw_obj out_obj s_obj se_obj sw_obj u_obj w_obj`.
31
32 `LibraryMessages`
33   If defined (between Includes of `Parser` and `VerbLib`), changes standard
34   library messages:
35
36   .. only:: html
37
38     | `Object LibraryMessages`
39     |   `with before [;`
40     |        `{action}: "{string}";`
41     |        `{action}: "{string}";`
42     |        `{action}: switch (lm_n) {`
43     |                `{value}: "{string}";`
44     |                `{value}: "{string}",`
45     |                    `(a) lm_o,".";`
46     |                `...`
47     |                `}`
48     |            `...`
49     |        `];`
50
51   .. todo::
52
53      Get this to work properly in LaTeX.  Currently get a 'too deeply
54      nested' error.
55
56 `selfobj`
57   The default player object.  Avoid: use instead the `player` variable,
58   which usually refers to `selfobj`.
59
60 `thedark`
61   A pseudo-room which becomes the `location` when there is no light
62   (although the player object is not moved there).
63
64 Library constants
65 =================
66
67 In addition to the standard constants `true` (1), `false` (0) and `nothing`
68 (0), the Library defines `NULL` (-1) for an `{action}`, `{property}` or
69 `{pronoun}` whose current value is undefined.
70
71 `LIBRARY_PARSER`, `LIBRARY_ENGLISH`, `LIBRARY_VERBLIB` and
72 `LIBRARY_GRAMMAR` are defined to mark the end of inclusion of `Parser.h`,
73 `English.h`, `VerbLib.h` and `Grammar.h` respectively.
74
75 User-defined constants
76 ======================
77
78 Some constants control features rather than represent values.
79
80 `AMUSING_PROVIDED`
81   Activates the `Amusing` entry point.
82
83 `COMMENT_CHARACTER = '{char}'`
84   Introduces a comment line ignored by the parser (default "*").
85
86 `DEATH_MENTION_UNDO`
87   Offers "UNDO the last move" at game end.
88
89 `DEBUG`
90   Activates the debug commands.
91
92 `Headline = "{string}"`
93   **Mandatory**: game style, copyright info, etc.
94
95 `MANUAL_PRONOUNS`
96   Pronouns reflect only objects mentioned by the player.
97
98 `MAX_CARRIED = {expr}`
99   Limit on direct possessions that the player can carry (default 100).
100
101 `MAX_SCORE = {expr}`
102   Maximum game score (default 0).
103
104 `MAX_TIMERS = {expr}`
105   Limit on active timers/daemons (default 32).
106
107 `NO_PLACES`
108   "`OBJECTS`" and "`PLACES`" verbs are barred.
109
110 `NO_SCORE`
111   Game doesn't use scoring.
112
113 `NUMBER_TASKS = {expr}`
114   Number of `scored` tasks (default 1).
115
116 `OBJECT_SCORE = {expr}`
117   For taking a `scored` object for the first time (default 4).
118
119 `ROOM_SCORE = {expr}`
120   For visiting a `scored` room for the first time (default 5).
121
122 `SACK_OBJECT = {obj_id}`
123   A `container` object where the game places held objects.
124
125 `START_MOVE = {expr}`
126   Initial value of turns counter (default 0).
127
128 `Story = "{string}"`
129   **Mandatory**: the name of the story.
130
131 `TASKS_PROVIDED`
132   Activates the task scoring system.
133
134 `USE_MODULES`
135   Activates linking with pre-compiled library modules.
136
137 `WITHOUT_DIRECTIONS`
138   De-activates standard compass directions (bar "`IN`" and "`OUT`").  Place
139   alternative directions in the `compass`.
140
141 Library variables
142 =================
143
144 `action`
145   The current `{action}`.
146
147 `actor`
148   The target of an instruction: the player, or an NPC.
149
150 `deadflag`
151   Normally 0: 1 indicates a regular death, 2 indicates that the player has
152   won, 3 or more denotes a user-defined end.
153
154 `inventory_stage`
155   Used by `invent` and `list_together` properties.
156
157 `keep_silent`
158   Normally `false`; `true` makes most group 2 actions silent.
159
160 `location`
161   The player's current room; unless that's dark, when it contains
162   `thedark`, `real_location` contains the room.
163
164 `notify_mode`
165   Normally `true`: `false` remains silent when score changes.
166
167 `noun`
168   The primary focus object for the current action.
169
170 `player`
171   The object acting on behalf of the human player.
172
173 `real_location`
174   The player's current room when in the dark.
175
176 `score`
177   The current score.
178
179 `second`
180   The secondary focus object for the current action.
181
182 `self`
183   The object which received a message.  (Note: a run-time variable, not a
184   compile-time constant.)
185
186 `sender`
187   The object which sent a message (or `nothing`).
188
189 `task_scores`
190   A byte array holding scores for the task scoring system.
191
192 `the_time`
193   The game's clock, in minutes 0..1439 since midnight.
194
195 `turns`
196   The game's turn counter.
197
198 `wn`
199   The input stream word number, counting from 1.
200
201 Library routines
202 ================
203
204 `Achieved({expr})`
205   A scored task has been achieved.
206
207 `AfterRoutines()`
208   In a group 2 action, controls output of "after" messages.
209
210 `AllowPushDir()`
211   An object can be pushed from one location to another.
212
213 `Banner()`
214   Prints the game banner.
215
216 `ChangePlayer({obj_id,flag})`
217   Player assumes the persona of the `{obj_id}`.  If the optional `{flag}`
218   is `true`, room descriptions include "(as `{object}`)".
219
220 `CommonAncestor({obj_id1,obj_id2})`
221   Returns the nearest object which has a parental relationship to both
222   `{obj_ids}`, or `nothing`.
223
224 `DictionaryLookup({byte_array,length})`
225   Returns address of word in dictionary, or 0 if not found.
226
227 `DrawStatusLine()`
228   Refreshes the status line; happens anyway at end of each turn.
229
230 `GetGNAOfObject(obj_id)`
231   Returns gender-number-animation 0..11 of the `{obj_id}`.
232
233 `HasLightSource(obj_id)`
234   Returns `true` if the `{obj_id}` has light.
235
236 `IndirectlyContains({parnt_obj_id,obj_id})`
237   Returns `true` if `{obj_id}` is currently a child or grand-child or
238   great-grand-child... of the `{parent_object}`.
239
240 `IsSeeThrough(obj_id)`
241   Returns `true` if light can pass through the `{obj_id}`.
242
243 `Locale({obj_id,"string1","string2"})`
244   Describes the contents of `{obj_id}`, and returns their number.  After
245   objects with own paragraphs, the rest are listed preceded by `{string1}`
246   or `{string2}`.
247
248 `LoopOverScope({routine_id,actor})`
249   Calls `{routine_id}({obj_id})` for each `{obj_id}` in scope.  If the
250   optional `{actor}` is supplied, that defines the scope.
251
252 `MoveFloatingObjects()`
253   Adjusts positions of game's `found_in` objects.
254
255 `NextWord()`
256   Returns the next dictionary word in the input stream, incrementing `wn`
257   by one.  Returns `false` if the word is not in the dictionary, or if the
258   input stream is exhausted.
259
260 `NextWordStopped()`
261   Returns the next dictionary word in the input stream, incrementing `wn`
262   by one.  Returns `false` if the word is not in the dictionary, -1 if the
263   input stream is exhausted.
264
265 `NounDomain({obj_id1,obj_id2,type})`
266   Performs object parsing; see also `ParseToken()`.
267
268 `ObjectIsUntouchable({obj_id,flag})`
269   Tests whether there is a barrier - a container object which is not open -
270   between player and `{obj_id}`.  Unless the optional `{flag}` is `true`,
271   outputs "You can't because ... is in the way".  Returns `true` is a
272   barrier is found, otherwise `false`.
273
274 `OffersLight({obj_id})`
275   Returns `true` if the `{obj_id}` offers light.
276
277 `ParseToken({type,value})`
278   Performs general parsing; see also `NounDomain()`.
279
280 `PlaceInScope({obj_id})`
281   Used in an `add_to_scope` property or `scope=` token to put the
282   `{obj_id}` into scope for the parser.
283
284 `PlayerTo({obj_id,flag})`
285   Moves the player to `{obj_id}`.  Prints its description unless optional
286   `{flag}` is 1 (no description) or 2 (as if walked in).
287
288 `PrintOrRun({obj_id,property,flag})`
289   If `{obj_id.property}` is a string, output it (followed by a newline
290   unless optional `{flag}` is `true`), and return `true`.  If it's a
291   routine, run it and return what the routine returns.
292
293 `PronounNotice({obj_id})`
294   Associates an appropriate pronoun with the `{obj_id}`.
295
296 `PronounValue('{pronoun}')`
297   Returns the object to which '`it`' (or '`him`', '`her`', '`them`')
298   currently refers, or `nothing`.
299
300 `ScopeWithin({obj_id})`
301   Used in an `add_to_scope` property or `scope=` token to put the contents
302   of the `{obj_id}` in scope for the parser.
303
304 `SetPronoun('{pronoun}',{obj_id})`
305   Defines the `{obj_id}` to which a given pronoun refers.
306
307 `SetTime({expr1,expr2})`
308
309   Sets `the_time` to `{expr1}` (in mins 0..1439 since midnight), running at
310   `{expr2}` -
311
312   | +ve: `{expr2}` minutes pass each turn;
313   | -ve: `{-expr2}` turns take one minute;
314   | zero: time stands still.
315
316 `StartDaemon({obj_id})`
317   Starts the `{obj_id}`\'s daemon.
318
319 `StartTimer({obj_id,expr})`
320   Starts the `{obj_id}`\'s timer, initialising its `time_left` to `{expr}`.
321   The object's `time_out` property will be called after that number of
322   turns have elapsed.
323
324 `StopDaemon({obj_id})`
325   Stops the `{obj_id}`\'s daemon.
326
327 `StopTimer({obj_id})`
328   Stops the `{obj_id}`\'s timer.
329
330 `TestScope({obj_id,actor})`
331   Returns `true` if the `{obj_id}` is in scope, otherwise `false`.  If the
332   optional `{actor}` is supplied, that defines the scope.
333
334 `TryNumber({expr})`
335   Parses word `{expr}` in the input stream as a number, recognising
336   decimals, also English words one..twenty.  Returns the number 1..10000,
337   or -1000 if the parse fails.
338
339 `UnsignedCompare({expr1,expr2})`
340   Returns -1 if `{expr1}` is less than `{expr2}`, 0 if `{expr1}` equals
341   `{expr2}`, and 1 if `{expr1}` is greater than `{expr2}`.  Both
342   expressions are unsigned, in the range 0..65535.
343
344 `WordAddress({expr})`
345   Returns a byte array containing the raw text of word `{expr}` in the
346   input stream.
347
348 `WordInProperty({word,obj_id,property})`
349   Returns `true` if the dictionary `{word}` is listed in the `{property}`
350   values for the `{obj_id}`.
351
352 `WordLength({expr})`
353   Returns the length of word `{expr}` in the input stream.
354
355 `WriteListFrom({obj_id,expr})`
356   Outputs a list of `{obj_id}` and its siblings, in the given style, an
357   `{expr}` formed by adding any of: `ALWAYS_BIT`, `CONCEAL_BIT`,
358   `DEFART_BIT`, `ENGLISH_BIT`, `FULLINV_BIT`, `INDENT_BIT`, `ISARE_BIT`,
359   `NEWLINE_BIT`, `PARTINV_BIT`, `RECURSE_BIT`, `TERSE_BIT`, `WORKFLAG_BIT`.
360
361 `YesOrNo()`
362   Returns `true` if the player types "`YES`", `false` for "`NO`".
363
364 `ZRegion({arg})`
365   Returns the type of its `{arg}` : 3 for a string address, 2 for a routine
366   address, 1 for an object number, or 0 otherwise.
367
368 Object properties
369 =================
370
371 Where the `value` of a property can be a routine, several formats are
372 possible (but remember: embedded "`]`" returns `false`, standalone "`]`"
373 returns `true`):
374
375   | `{property} [; {stmt}; {stmt}; ... ]`
376   | `{property} [; return {routine_id}(); ]`
377   | `{property} [; {routine_id}(); ]`
378   | `{property} {routine_id}`
379
380 In this appendix, |ADD| marks an additive property.  Where a `Class` and an
381 `Object` of that class both define the same property, the value specified
382 for the `Object` normally overrides the value inherited from the `Class`.
383 However, if the property is additive then both values apply, with the
384 Object's value being considered first.
385
386 `add_to_scope`
387   For an object: additional objects which follow it in and out of scope.
388   The `{value}` can be a space-separated list of `{obj_ids}`, or a routine
389   which invokes `PlaceInScope()` or `ScopeWithin()` to specify objects.
390
391 `after` |ADD|
392   For an object: receives every `{action}` and `{fake_action}` for which
393   this is the `{noun}`.  For a room: receives every `{action}` which occurs
394   here.
395
396   The `{value}` is a routine of structure similar to a `switch` statement,
397   having cases for the appropriate `{actions}` (and an optional `default`
398   as well); it is invoked after the action has happened, but before the
399   player has been informed.  The routine should return `false` to continue,
400   telling the player what has happened, or `true` to stop processing the
401   action and produce no further output.
402
403 `article`
404   For an object: the object's indefinite article - the default is
405   automatically "a", "an" or "some".  The `{value}` can be a string, or a
406   routine which outputs a string.
407
408 `articles`
409   For a non-English object: its definite and indefinite articles.  The
410   `{value}` is an array of strings.
411
412 `before` |ADD|
413   For an object: receives every `{action}` and `{fake_action}` for which
414   this is the `{noun}`.  For a room: receives every action which occurs
415   here.
416
417   The `{value}` is a routine invoked before the action has happened.  See
418   `after`.
419
420 `cant_go`
421   For a room: the message when the player attempts an impossible exit.  The
422   `{value}` can be a string, or a routine which outputs a string.
423
424 `capacity`
425   For a `container` or `supporter` object: the number of objects which can
426   be placed in or on it - the default is 100.
427
428   For the player: the number which can be carried - `selfobj` has an
429   initial capacity of `MAX_CARRIED`.
430
431   The `{value}` can be a number, or a routine which returns a number.
432
433 `d_to`
434   For a room: a possible exit.  The `{value}` can be
435
436   * `false` (the default): not an exit;
437   * a string: output to explain why this is not an exit;
438   * a `{room}`: the exit leads to this room;
439   * a `door` object: the exit leads through this door;
440   * a routine which should return `false`, a string, a `{room}`, a `door`
441     object, or `true` to signify "not an exit" and produce no further
442     output.
443
444 `daemon`
445   The `{value}` is a routine which can be activated by
446   `StartDaemon({obj_id})` and which then runs once each turn until
447   deactivated by `StopDaemon({obj_id})`.
448
449 `describe` |ADD|
450   For an object: called before the object's description is output.  For a
451   room: called before the room's (long) description is output.
452
453   The `{value}` is a routine which should return `false` to continue,
454   outputting the usual description, or `true` to stop processing and
455   produce no further output.
456
457 `description`
458   For an object: its description (output by `Examine`).
459
460   For a room: its long description (output by `Look`).
461
462   The `{value}` can be a string, or a routine which outputs a string.
463
464 `door_dir`
465   For a `compass` object (`d_obj`, `e_obj`, ...): the direction in which an
466   attempt to move to this object actually leads.
467
468   For a `door` object: the direction in which this door leads.
469
470   The `{value}` can be a directional property (`d_to`, `e_to`, ...), or a
471   routine which returns such a property.
472
473 `door_to`
474   For a `door` object: where it leads.  The value can be
475
476   * `false` (the default): leads nowhere;
477   * a string: output to explain why door leads nowhere;
478   * a `{room}`: the door leads to this room;
479   * a routine which should return `false`, a string, a `{room}`, or `true`
480     to signify "leads nowhere" without producing any output.
481
482 `e_to`
483   See `d_to`.
484
485 `each_turn` |ADD|
486   Invoked at the end of each turn (after all appropriate daemons and
487   timers) whenever the object is in scope.  The `{value}` can be a string,
488   or a routine.
489
490 `found_in`
491   For an object: the rooms where this object can be found, unless it has
492   the `absent` attribute.  The `{value}` can be
493
494   * a space-separated list of `{rooms}` (where this object can be found) or
495      `{obj_ids}` (whose locations are tracked by this object);
496   * a routine which should return `true` if this object can be found in the
497      current location, otherwise `false`.
498
499 `grammar`
500   For an `animate` or `talkable` object: the `{value}` is a routine called
501   when the parser knows that this object is being addressed, but has yet to
502   test the grammar.  The routine should return `false` to continue, `true`
503   to indicate that the routine has parsed the entire command, or a
504   dictionary word ('`word`' or -'`word`').
505
506 `in_to`
507   See `d_to`.
508
509 `initial`
510   For an object: its description before being picked up.
511
512   For a room: its description when the player enters the room.
513
514   The `{value}` can be a string, or a routine which outputs a string.
515
516 `inside_description`
517   For an `enterable` object: its description, output as part of the room
518   description when the player is inside the object.
519
520   The `{value}` can be a string, or a routine which outputs a string.
521
522 `invent`
523   For an object: the `{value}` is a routine for outputting the object's
524   inventory listing, which is called twice.  On the first call nothing has
525   been output; `inventory_stage` has the value 1, and the routine should
526   return `false` to continue, or `true` to stop processing and produce no
527   further output.  On the second call the object's indefinite article and
528   short name have been output, but not any subsidiary information;
529   `inventory_stage` has the value 2, and the routine should return `false`
530   to continue, or `true` to stop processing and produce no further output.
531
532 `life` |ADD|
533   For an `animate` object: receives person-to-person actions (`Answer`,
534   `Ask`, `Attack`, `Give`, `Kiss`, `Order`, `Show`, `Tell`, `ThrowAt` and
535   `WakeOther`) for which this is the `{noun}`.  The `{value}` is a routine
536   of structure similar to a `switch` statement, having cases for the
537   appropriate `{actions}` (and an optional default as well).  The routine
538   should return `false` to continue, telling the player what has happened,
539   or `true` to stop processing the action and produce no further output.
540
541 `list_together`
542
543   For an object: groups related objects when outputting an inventory or
544   room contents list.  The `{value}` can be
545
546   * a `{number}`: all objects having this value are grouped;
547   * a `{string}`: all objects having this value are grouped as a count of
548     the string;
549   * a routine which is called twice.  On the first call nothing has been
550     output; `inventory_stage` has the value 1, and the routine should
551     return `false` to continue, or `true` to stop processing and produce no
552     further output.  On the second call the list has been output;
553     `inventory_stage` has the value 2, and there is no test on the return
554     value.
555
556 `n_to`
557   See `d_to`.
558
559 `name` |ADD|
560   Defines a space-separated list of words which are added to the Inform
561   dictionary.  Each word can be supplied in apostrophes '...'  or quotes
562   "..."; in all other cases only words in apostrophes update the
563   dictionary.
564
565   For an object: identifies this object.
566
567   For a room: outputs "does not need to be referred to".
568
569 `ne_to`
570   See `d_to`.
571
572 `number`
573   For an object or room: the `{value}` is a general-purpose variable freely
574   available for use by the program.  A `player` object must provide (but
575   not use) this variable.
576
577 `nw_to`
578   See `d_to`.
579
580 `orders` |ADD|
581   For an `animate` or `talkable` object: the `{value}` is a routine called
582   to carry out the player's orders.  The routine should return `false` to
583   continue, or `true` to stop processing the action and produce no further
584   output.
585
586 `out_to`
587   See `d_to`.
588
589 `parse_name`
590   For an object: the `{value}` is a routine called to parse an object's
591   name.  The routine should return zero if the text makes no sense, -1 to
592   cause the parser to resume, or the positive number of words matched.
593
594 `plural`
595   For an object: its plural form, when in the presence of others like it.
596   The `{value}` can be a string, or a routine which outputs a string.
597
598 `react_after`
599   For an object: detects nearby actions - those which take place when this
600   object is in scope.  The `{value}` is a routine invoked after the action
601   has happened, but before the player has been informed.  See `after`.
602
603 `react_before`
604   For an object: detects nearby actions - those which take place when this
605   object is in scope.  The `{value}` is a routine invoked before the action
606   has happened.  See `after`.
607
608 `s_to`
609
610 `se_to`
611   See `d_to`.
612
613 `short_name`
614   For an object: an alternative or extended short name.  The `{value}` can
615   be a string, or a routine which outputs a string.  The routine should
616   return `false` to continue by outputting the object's *actual* short name
617   (from the head of the object definition), or `true` to stop processing
618   the action and produce no further output.
619
620 `short_name_indef`
621   For a non-English object: the short name when preceded by an indefinite
622   object.  The `{value}` can be a string, or a routine which outputs a
623   string.
624
625 `sw_to`
626   See `d_to`.
627
628 `time_left`
629   For a timer object: the `{value}` is a variable to hold the number of
630   turns left until this object's timer - activated and initialised by
631   `StartTimer({obj_id})` - counts down to zero and invokes the object's
632   `time_out` property.
633
634 `time_out`
635   For a timer object: the `{value}` is a routine which is run when the
636   object's `time_left` value - initialised by `StartTimer({obj_id})`, and
637   not in the meantime cancelled by `StopTimer({obj_id})` - counts down to
638   zero.
639
640 `u_to`
641
642 `w_to`
643   See `d_to`.
644
645 `when_closed`
646
647 `when_open`
648   For a `container` or `door` object: used when including this object in a
649   room's long description.  The `{value}` can be a string, or a routine
650   which outputs a string.
651
652 `when_off`
653
654 `when_on`
655   For a `switchable` object: used when including this object in a room's
656   long description.  The `{value}` can be a string, or a routine which
657   outputs a string.
658
659 `with_key`
660   For a `lockable` object: the `{obj_id}` (generally some kind of key)
661   needed to lock and unlock the object, or `nothing` if no key fits.
662
663 Object attributes
664 =================
665
666 `absent`
667      For a floating object (one with a `found_in` property, which can
668      appear in many rooms): is no longer there.
669
670 `animate`
671      For an object: is a living creature.
672
673 `clothing`
674      For an object: can be worn.
675
676 `concealed`
677      For an object: is present but hidden from view.
678
679 `container`
680      For an object: other objects can be put in (but not on) it.
681
682 `door`
683      For an object: is a door or bridge between rooms.
684
685 `edible`
686      For an object: can be eaten.
687
688 `enterable`
689      For an object: can be entered.
690
691 `female`
692      For an `animate` object: is female.
693
694 `general`
695      For an object or room: a general-purpose flag.
696
697 `light`
698      For an object or room: is giving off light.
699
700 `lockable`
701      For an object: can be locked; see the `with_key` property.
702
703 `locked`
704      For an object: can't be opened.
705
706 `male`
707      For an `animate` object: is male.
708
709 `moved`
710      For an object: is being, or has been, taken by the player.
711
712 `neuter`
713      For an `animate` object: is neither male nor female.
714
715 `on`
716      For a `switchable` object: is switched on.
717
718 `open`
719      For a `container` or door object: is open.
720
721 `openable`
722      For a `container` or `door` object: can be opened.
723
724 `pluralname`
725      For an object: is plural.
726
727 `proper`
728      For an object: the short name is a proper noun, therefore not to be
729      preceded by "The" or "the".
730
731 `scenery`
732      For an object: can't be taken; is not listed in a room description.
733
734 `scored`
735      For an object: awards `OBJECT_SCORE` points when taken for the first
736      time.  For a room: awards `ROOM_SCORE` points when visited for the
737      first time.
738
739 `static`
740      For an object: can't be taken.
741
742 `supporter`
743      For an object: other objects can be put on (but not in) it.
744
745 `switchable`
746      For an object: can be switched off or on.
747
748 `talkable`
749      For an object: can be addressed in "object, do this" style.
750
751 `transparent`
752      For a `container` object: objects inside it are visible.
753
754 `visited`
755      For a room: is being, or has been, visited by the player.
756
757 `workflag`
758      Temporary internal flag, also available to the program.
759
760 `worn`
761      For a `clothing` object: is being worn.
762
763 Optional entry points
764 =====================
765
766 These routines, if you supply them, are called when shown.
767
768 `AfterLife()`
769   Player has died; `deadflag=0` resurrects.
770
771 `AfterPrompt()`
772   The ">" prompt has been output.
773
774 `Amusing()`
775   Player has won; `AMUSING_PROVIDED` is defined.
776
777 `BeforeParsing()`
778   The parser has input some text, set up the buffer and parse tables, and
779   initialised `wn` to 1.
780
781 `ChooseObjects({object,flag})`
782   Parser has found "`ALL`" or an ambiguous noun phrase and decided that
783   `{object}` should be excluded (`flag` is 0), or included (`flag` is 1).
784   The routine should return 0 to let this stand, 1 to force inclusion, or 2
785   to force exclusion.  If `flag` is 2, parser is undecided; routine should
786   return appropriate score 0..9.
787
788 `DarkToDark()`
789   The player has gone from one dark room to another.
790
791 `DeathMessage()`
792   The player has died; `deadflag` is 3 or more.
793
794 `GamePostRoutine()`
795   Called after all actions.
796
797 `GamePreRoutine()`
798   Called before all actions.
799
800 `Initialise()`
801   **Mandatory; note British spelling**: called at start.  Must set
802   `location`; can return 2 to suppress game banner.
803
804 `InScope()`
805   Called during parsing.
806
807 `LookRoutine()`
808   Called at the end of every `Look` description.
809
810 `NewRoom()`
811   Called when room changes, before description is output.
812
813 `ParseNoun({object})`
814   Called to parse the `{object}`\'s name.
815
816 `ParseNumber({byte_array,length})`
817   Called to parse a number.
818
819 `ParserError({number})`
820   Called to handle an error.
821
822 `PrintRank()`
823   Completes the output of the score.
824
825 `PrintTaskName({number})`
826   Prints the name of the task.
827
828 `PrintVerb({addr})`
829   Called when an unusual verb is printed.
830
831 `TimePasses()`
832   Called after every turn.
833
834 `UnknownVerb()`
835   Called when an unusual verb is encountered.
836
837 Group 1 actions
838 ===============
839
840 Group 1 actions support the 'meta' verbs.  These are the standard actions
841 and their triggering verbs.
842
843 ==============  =====================================================
844 `CommandsOff`   "`RECORDING OFF`"
845 `CommandsOn`    "`RECORDING [ON]`"
846 `CommandsRead`  "`REPLAY`"
847 `FullScore`     "`FULLSCORE`", "`FULL [SCORE]`"
848 `LMode1`        "`BRIEF`", "`NORMAL`"
849 `LMode2`        "`LONG`", "`VERBOSE`"
850 `LMode3`        "`SHORT`", "`SUPERBRIEF`"
851 `NotifyOff`     "`NOTIFY OFF`"
852 `NotifyOn`      "`NOTIFY [ON]`"
853 `Objects`       "`OBJECTS`"
854 `Places`        "`PLACES`"
855 `Pronouns`      "`[PRO]NOUNS`"
856 `Quit`          "`DIE`", "`Q[UIT]`"
857 `Restart`       "`RESTART`"
858 `Restore`       "`RESTORE`"
859 `Save`          "`CLOSE`"
860 `Score`         "`SCORE`"
861 `ScriptOff`     "`[TRAN]SCRIPT OFF`", "`NOSCRIPT`", "`UNSCRIPT`"
862 `ScriptOn`      "`[TRAN]SCRIPT [ON]`"
863 `Verify`        "`VERIFY`"
864 `Version`       "`VERSION`"
865 ==============  =====================================================
866
867 and the debug tools.
868
869 ===============   ===================================================
870 `ActionsOff`      "`ACTIONS OFF`"
871 `ActionsOn`       "`ACTIONS [ON]`"
872 `ChangesOff`      "`CHANGES OFF`"
873 `ChangesOn`       "`CHANGES [ON]`"
874 `Gonear`          "`GONEAR`"
875 `Goto`            "`GOTO`"
876 `Predictable`     "`RANDOM`"
877 `RoutinesOff`     "`MESSAGES OFF`", "`ROUTINES OFF`"
878 `RoutinesOn`      "`MESSAGES [ON]`", "`ROUTINES [ON]`"
879 `Scope`           "`SCOPE`"
880 `Showobj`         "`SHOWOBJ`"
881 `Showverb`        "`SHOWVERB`"
882 `TimersOff`       "`DAEMONS OFF`", "`TIMERS OFF`"
883 `TimersOn`        "`DAEMONS [ON]`", "`TIMERS [ON]`"
884 `TraceLevel`      "`TRACE number`"
885 `TraceOff`        "`TRACE OFF`"
886 `TraceOn`         "`TRACE [ON]`"
887 `XAbstract`       "`ABSTRACT`"
888 `XPurloin`        "`PURLOIN`"
889 `XTree`           "`TREE`"
890 ===============   ===================================================
891
892 Group 2 actions
893 ===============
894
895 Group 2 actions usually work, given the right circumstances.
896
897 =============   =============================================================
898 `Close`         "`CLOSE [UP]`", "`COVER [UP]`", "`SHUT [UP]`"
899 `Disrobe`       "`DISROBE`", "`DOFF`", "`REMOVE`", "`SHED`", "`TAKE OFF`"
900 `Drop`          "`DISCARD`", "`DROP`", "`PUT DOWN`", "`THROW`"
901 `Eat`           "`EAT`"
902 `Empty`         "`EMPTY [OUT]`"
903 `EmptyT`        "`EMPTY IN|INTO|ON|ONTO|TO`"
904 `Enter`         "`CROSS`", "`ENTER`", "`GET IN|INTO|ON|ONTO`",
905                 "`GO IN|INSIDE|INTO|THROUGH`",
906                 "`LEAVE IN|INSIDE|INTO|THROUGH`", "`LIE IN|INSIDE|ON`",
907                 "`LIE ON TOP OF`",
908                 "`RUN IN|INSIDE|INTO|THROUGH`", "`SIT IN|INSIDE|ON`",
909                 "`SIT ON TOP OF`", "`STAND ON`",
910                 "`WALK IN|INSIDE|INTO|THROUGH`"
911 `Examine`       "`CHECK,`" "`DESCRIBE`", "`EXAMINE`",
912                 "`L[OOK] AT`", "`READ`", "`WATCH`", "`X`"
913 `Exit`          "`EXIT`", "`GET OFF|OUT|UP`",
914                 "`LEAVE`", "`OUT[SIDE]`", "`STAND [UP]`"
915 `GetOff`        "`GET OFF`"
916 `Give`          "`FEED [TO]`", "`GIVE [TO]`", "`OFFER [TO]`", "`PAY [TO]`"
917 `Go`            "`GO`", "`LEAVE`", "`RUN`", "`WALK`"
918 `GoIn`          "`CROSS`", "`ENTER`", "`IN[SIDE]`"
919 `Insert`        "`DISCARD IN|INTO`",
920                 "`DROP DOWN|IN|INTO`",
921                 "`INSERT IN|INTO`",
922                 "`PUT IN|INSIDE|INTO`",
923                 "`THROW DOWN|IN|INTO`"
924 `Inv`           "`I[NV]`", "`INVENTORY`", "`TAKE INVENTORY`"
925 `InvTall`       "`I[NV] TALL`", "`INVENTORY TALL`"
926 `InvWide`       "`I[NV] WIDE`", "`INVENTORY WIDE`"
927 `Lock`          "`LOCK WITH`"
928 `Look`          "`L[OOK]`"
929 `Open`          "`OPEN`", "`UNCOVER`", "`UNDO`", "`UNWRAP`"
930 `PutOn`         "`DISCARD ON|ONTO`",
931                 "`DROP ON|ONTO`",
932                 "`PUT ON|ONTO`",
933                 "`THROW ON|ONTO`"
934 `Remove`        "`GET FROM`", "`REMOVE FROM`", "`TAKE FROM|OFF`"
935 `Search`        "`L[OOK] IN|INSIDE|INTO|THROUGH`", "`SEARCH`"
936 `Show`          "`DISPLAY [TO]`", "`PRESENT [TO]`", "`SHOW [TO]`"
937 `SwitchOff`     "`CLOSE OFF`", "`SCREW OFF`",
938                 "`SWITCH OFF`", "`TURN OFF`",
939                 "`TWIST OFF`"
940 `SwitchOn`      "`SCREW ON`", "`SWITCH ON`",
941                 "`TURN ON`", "`TWIST ON`"
942 `Take`          "`CARRY`", "`GET`", "`HOLD`",
943                 "`PEEL [OFF]`", "`PICK UP`",
944                 "`REMOVE`", "`TAKE`"
945 `Transfer`      "`CLEAR TO`", "`MOVE TO`",
946                 "`PRESS TO`", "`PUSH TO`",
947                 "`SHIFT TO`", "`TRANSFER TO`"
948 `Unlock`        "`OPEN WITH`", "`UNDO WITH`",
949                 "`UNLOCK WITH`"
950 `VagueGo`       "`GO`", "`LEAVE`", "`RUN`", "`WALK`"
951 `Wear`          "`DON`", "`PUT ON`", "`WEAR`"
952 =============   =============================================================
953
954 Group 3 actions
955 ===============
956
957 Group 3 actions are by default stubs which output a message and stop at the
958 "before" stage (so there is no "after" stage).
959
960 =============   =============================================================
961 `Answer`        "`ANSWER TO`", "`SAY TO`",
962                 "`SHOUT TO`", "`SPEAK TO`"
963 `Ask`           "`ASK ABOUT`"
964 `AskFor`        "`ASK FOR`"
965 `Attack`        "`ATTACK`", "`BREAK`", "`CRACK`",
966                 "`DESTROY`", "`FIGHT`", "`HIT`",
967                 "`KILL`", "`MURDER`", "`PUNCH`",
968                 "`SMASH`", "`THUMP`", "`TORTURE`",
969                 "`WRECK`"
970 `Blow`          "`BLOW`"
971 `Burn`          "`BURN [WITH]`", "`LIGHT [WITH]`"
972 `Buy`           "`BUY`" "`PURCHASE`"
973 `Climb`         "`CLIMB [OVER|UP]`", "`SCALE`"
974 `Consult`       "`CONSULT ABOUT|ON`",
975                 "`LOOK UP IN`",
976                 "`READ ABOUT IN`", "`READ IN`"
977 `Cut`           "`CHOP,`" "`CUT`", "`PRUNE`", "`SLICE`"
978 `Dig`           "`DIG [WITH]`"
979 `Drink`         "`DRINK`", "`SIP`", "`SWALLOW`"
980 `Fill`          "`FILL`"
981 `Jump`          "`HOP`", "`JUMP`", "`SKIP`"
982 `JumpOver`      "`HOP OVER`", "`JUMP OVER`", "`SKIP OVER`"
983 `Kiss`          "`EMBRACE`", "`HUG`", "`KISS`"
984 `Listen`        "`HEAR`", "`LISTEN [TO]`"
985 `LookUnder`     "`LOOK UNDER`"
986 `Mild`          Various mild swearwords.
987 `No`            "`NO`"
988 `Pray`          "`PRAY`"
989 `Pull`          "`DRAG`" "`PULL`"
990 `Push`          "`CLEAR`", "`MOVE`", "`PRESS`",
991                 "`PUSH`", "`SHIFT`"
992 `PushDir`       "`CLEAR`", "`MOVE`", "`PRESS`",
993                 "`PUSH`", "`SHIFT`"
994 `Rub`           "`CLEAN`", "`DUST`", "`POLISH`",
995                 "`RUB`", "`SCRUB`", "`SHINE`",
996                 "`SWEEP`", "`WIPE`"
997 `Set`           "`ADJUST`", "`SET`"
998 `SetTo`         "`ADJUST TO`", "`SET TO`"
999 `Sing`          "`SING`"
1000 `Sleep`         "`NAP`", "`SLEEP`"
1001 `Smell`         "`SMELL`", "`SNIFF`"
1002 `Sorry`         "`SORRY`"
1003 `Squeeze`       "`SQUASH`", "`SQUEEZE`"
1004 `Strong`        Various strong swearwords.
1005 `Swim`          "`DIVE`", "`SWIM`"
1006 `Swing`         "`SWING [ON]`"
1007 `Taste`         "`TASTE`"
1008 `Tell`          "`TELL ABOUT`"
1009 `Think`         "`THINK`"
1010 `ThrowAt`       "`THROW AGAINST|AT|ON|ONTO`"
1011 `Tie`           "`ATTACH [TO]`", "`FASTEN [TO]`",
1012                 "`FIX [TO]`", "`TIE [TO]`"
1013 `Touch`         "`FEEL,`" "`FONDLE`", "`GROPE`", "`TOUCH`"
1014 `Turn`          "`ROTATE`", "`SCREW`", "`TURN`",
1015                 "`TWIST`", "`UNSCREW`"
1016 `Wait`          "`WAIT`" "`Z`"
1017 `Wake`          "`AWAKE[N]`", "`WAKE [UP]`"
1018 `WakeOther`     "`AWAKE[N]`", "`WAKE [UP]`"
1019 `Wave`          "`WAVE`"
1020 `WaveHands`     "`WAVE`"
1021 `Yes`           "`Y[ES]`"
1022 =============   =============================================================
1023
1024 Fake actions
1025 ============
1026
1027 Fake actions handle some special cases, or represent "real" actions from
1028 the viewpoint of the second object.
1029
1030 ================   ========================================================
1031 `LetGo`            Generated by `Remove`.
1032 `ListMiscellany`   Outputs a range of inventory messages.
1033 `Miscellany`       Outputs a range of utility messages.
1034 `NotUnderstood`    Generated when parser fails to interpret some `orders`.
1035 `Order`            Receives things not handled by `orders`.
1036 `PluralFound`      Tells the parser that `parse_name()` has identified a
1037                    plural object.
1038 `Prompt`           Outputs the prompt, normally ">".
1039 `Receive`          Generated by `Insert` and `PutOn`.
1040 `TheSame`          Generated when parser can't distinguish between two
1041                    objects.
1042 `ThrownAt`         Generated by `ThrowAt`.
1043 ================   ========================================================