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