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