1 ==============================
2 Appendix F -- Inform library
3 ==============================
5 .. |ADD| replace:: **+**
7 .. The ⊕ symbol doesn't work in LaTeX.
13 .. image:: /images/picL.png
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.
25 A :attr:`container` object holding the twelve direction objects
26 :obj:`d_obj`, :obj:`e_obj`, :obj:`in_obj`, :obj:`n_obj`, :obj:`ne_obj`,
27 :obj:`nw_obj`, :obj:`out_obj`, :obj:`s_obj`, :obj:`se_obj`,
28 :obj:`sw_obj`, :obj:`u_obj`, :obj:`w_obj`.
30 :obj:`LibraryMessages`
31 If defined (between Includes of `Parser` and `VerbLib`), changes standard
34 | `Object LibraryMessages`
36 | `{action}: "{string}";`
37 | `{action}: "{string}";`
38 | `{action}: switch (lm_n) {`
39 | `{value}: "{string}";`
40 | `{value}: "{string}",`
48 The default player object. Avoid: use instead the :var:`player`
49 variable, which usually refers to :obj:`selfobj`.
52 A pseudo-room which becomes the :var:`location` when there is no light
53 (although the player object is not moved there).
58 In addition to the standard constants :const:`true` (1), :const:`false` (0)
59 and :const:`nothing` (0), the Library defines :const:`NULL` (-1) for an
60 `{action}`, `{property}` or `{pronoun}` whose current value is undefined.
62 `LIBRARY_PARSER`, `LIBRARY_ENGLISH`, `LIBRARY_VERBLIB` and
63 `LIBRARY_GRAMMAR` are defined to mark the end of inclusion of `Parser.h`,
64 `English.h`, `VerbLib.h` and `Grammar.h` respectively.
66 User-defined constants
67 ======================
69 Some constants control features rather than represent values.
72 Activates the `Amusing` entry point.
74 `COMMENT_CHARACTER = '{char}'`
75 Introduces a comment line ignored by the parser (default "*").
78 Offers "UNDO the last move" at game end.
81 Activates the debug commands.
83 `Headline = "{string}"`
84 **Mandatory**: game style, copyright info, etc.
87 Pronouns reflect only objects mentioned by the player.
89 `MAX_CARRIED = {expr}`
90 Limit on direct possessions that the player can carry (default 100).
93 Maximum game score (default 0).
96 Limit on active timers/daemons (default 32).
99 "`OBJECTS`" and "`PLACES`" verbs are barred.
102 Game doesn't use scoring.
104 `NUMBER_TASKS = {expr}`
105 Number of `scored` tasks (default 1).
107 `OBJECT_SCORE = {expr}`
108 For taking a `scored` object for the first time (default 4).
110 `ROOM_SCORE = {expr}`
111 For visiting a `scored` room for the first time (default 5).
113 `SACK_OBJECT = {obj_id}`
114 A `container` object where the game places held objects.
116 `START_MOVE = {expr}`
117 Initial value of turns counter (default 0).
120 **Mandatory**: the name of the story.
123 Activates the task scoring system.
126 Activates linking with pre-compiled library modules.
129 De-activates standard compass directions (bar "`IN`" and "`OUT`"). Place
130 alternative directions in the :obj:`compass`.
136 pair: action; library variable
139 The current `{action}`.
142 pair: actor; library variable
145 The target of an instruction: the player, or an NPC.
148 pair: deadflag; library variable
151 Normally 0: 1 indicates a regular death, 2 indicates that the player has
152 won, 3 or more denotes a user-defined end.
155 pair: inventory_stage; library variable
157 :var:`inventory_stage`
158 Used by :prop:`invent` and :prop:`list_together` properties.
161 pair: keep_silent; library variable
164 Normally :const:`false`; :const:`true` makes most :ref:`group 2 actions
165 <group-2-actions>` silent.
168 pair: location; library variable
171 The player's current room; unless that's dark, when it contains
172 :obj:`thedark`, :var:`real_location` contains the room.
175 pair: notify_mode; library variable
178 Normally :const:`true`: :const:`false` remains silent when score changes.
181 pair: noun; library variable
184 The primary focus object for the current action.
187 pair: player; library variable
190 The object acting on behalf of the human player.
193 pair: real_location; library variable
196 The player's current room when in the dark.
199 pair: score; library variable
205 pair: second; library variable
208 The secondary focus object for the current action.
211 pair: self; library variable
214 The object which received a message. (Note: a run-time variable, not a
215 compile-time constant.)
218 pair: sender; library variable
221 The object which sent a message (or `nothing`).
224 pair: task_scores; library variable
227 A byte array holding scores for the task scoring system.
230 pair: the_time; library variable
233 The game's clock, in minutes 0..1439 since midnight.
236 pair: turns; library variable
239 The game's turn counter.
242 pair: wn; library variable
245 The input stream word number, counting from 1.
247 .. _library-routines:
253 pair: Achieved; library routine
256 A scored task has been achieved.
259 pair: AfterRoutines; library routine
262 In a :ref:`group 2 action <group-2-actions>`, controls output of "after"
266 pair: AllowPushDir; library routine
269 An object can be pushed from one location to another.
272 pair: Banner; library routine
275 Prints the game banner.
278 pair: ChangePlayer; library routine
280 `ChangePlayer({obj_id,flag})`
281 Player assumes the persona of the `{obj_id}`. If the optional `{flag}`
282 is :const:`true`, room descriptions include "(as `{object}`)".
285 pair: CommonAncestor; library routine
287 `CommonAncestor({obj_id1,obj_id2})`
288 Returns the nearest object which has a parental relationship to both
289 `{obj_ids}`, or `nothing`.
292 pair: DictionaryLookup; library routine
294 `DictionaryLookup({byte_array,length})`
295 Returns address of word in dictionary, or 0 if not found.
298 pair: DrawStatusLine; library routine
301 Refreshes the status line; happens anyway at end of each turn.
304 pair: GetGNAOfObject; library routine
306 `GetGNAOfObject({obj_id})`
307 Returns gender-number-animation 0..11 of the `{obj_id}`.
310 pair: HasLightSource; library routine
312 `HasLightSource({obj_id})`
313 Returns :const:`true` if the `{obj_id}` has light.
316 pair: IndirectlyContains; library routine
318 `IndirectlyContains({parnt_obj_id,obj_id})`
319 Returns :const:`true` if `{obj_id}` is currently a child or grand-child
320 or great-grand-child... of the `{parent_object}`.
323 pair: IsSeeThrough; library routine
325 `IsSeeThrough({obj_id})`
326 Returns :const:`true` if light can pass through the `{obj_id}`.
329 pair: Locale; library routine
331 `Locale({obj_id,"string1","string2"})`
332 Describes the contents of `{obj_id}`, and returns their number. After
333 objects with own paragraphs, the rest are listed preceded by `{string1}`
337 pair: LoopOverScope; library routine
339 `LoopOverScope({routine_id,actor})`
340 Calls `{routine_id}({obj_id})` for each `{obj_id}` in scope. If the
341 optional `{actor}` is supplied, that defines the scope.
344 pair: MoveFloatingObjects; library routine
346 `MoveFloatingObjects()`
347 Adjusts positions of game's `found_in` objects.
350 pair: NextWord; library routine
353 Returns the next dictionary word in the input stream, incrementing
354 :var:`wn` by one. Returns :const:`false` if the word is not in the
355 dictionary, or if the input stream is exhausted.
358 pair: NextWordStopped; library routine
361 Returns the next dictionary word in the input stream, incrementing
362 :var:`wn` by one. Returns :const:`false` if the word is not in the
363 dictionary, -1 if the input stream is exhausted.
366 pair: NounDomain; library routine
368 `NounDomain({obj_id1,obj_id2,type})`
369 Performs object parsing; see also `ParseToken()`.
372 pair: ObjectIsUntouchable; library routine
374 `ObjectIsUntouchable({obj_id,flag})`
375 Tests whether there is a barrier - a container object which is not open -
376 between player and `{obj_id}`. Unless the optional `{flag}` is
377 :const:`true`, outputs "You can't because ... is in the way". Returns
378 :const:`true` is a barrier is found, otherwise :const:`false`.
381 pair: OffersLight; library routine
383 `OffersLight({obj_id})`
384 Returns :const:`true` if the `{obj_id}` offers light.
387 pair: ParseToken; library routine
389 `ParseToken({type,value})`
390 Performs general parsing; see also `NounDomain()`.
393 pair: PlaceInScope; library routine
395 `PlaceInScope({obj_id})`
396 Used in an :prop:`add_to_scope` property or `scope=` token to put the
397 `{obj_id}` into scope for the parser.
400 pair: PlayerTo; library routine
402 `PlayerTo({obj_id,flag})`
403 Moves the player to `{obj_id}`. Prints its description unless optional
404 `{flag}` is 1 (no description) or 2 (as if walked in).
407 pair: PrintOrRun; library routine
409 `PrintOrRun({obj_id,property,flag})`
410 If `{obj_id.property}` is a string, output it (followed by a newline
411 unless optional `{flag}` is :const:`true`), and return :const:`true`. If
412 it's a routine, run it and return what the routine returns.
415 pair: PronounNotice; library routine
417 `PronounNotice({obj_id})`
418 Associates an appropriate pronoun with the `{obj_id}`.
421 pair: PronounValue; library routine
423 `PronounValue('{pronoun}')`
424 Returns the object to which '`it`' (or '`him`', '`her`', '`them`')
425 currently refers, or :const:`nothing`.
428 pair: ScopeWithin; library routine
430 `ScopeWithin({obj_id})`
431 Used in an :prop:`add_to_scope` property or `scope=` token to put the
432 contents of the `{obj_id}` in scope for the parser.
435 pair: SetPronoun; library routine
437 `SetPronoun('{pronoun}',{obj_id})`
438 Defines the `{obj_id}` to which a given pronoun refers.
441 pair: SetTime; library routine
443 `SetTime({expr1,expr2})`
444 Sets `the_time` to `{expr1}` (in mins 0..1439 since midnight), running at
447 | +ve: `{expr2}` minutes pass each turn;
448 | -ve: `{-expr2}` turns take one minute;
449 | zero: time stands still.
452 pair: StartDaemon; library routine
454 `StartDaemon({obj_id})`
455 Starts the `{obj_id}`\'s daemon.
458 pair: StartTimer; library routine
460 `StartTimer({obj_id,expr})`
461 Starts the `{obj_id}`\'s timer, initialising its :prop:`time_left` to
462 `{expr}`. The object's :prop:`time_out` property will be called after
463 that number of turns have elapsed.
466 pair: StopDaemon; library routine
468 `StopDaemon({obj_id})`
469 Stops the `{obj_id}`\'s daemon.
472 pair: StopTimer; library routine
474 `StopTimer({obj_id})`
475 Stops the `{obj_id}`\'s timer.
478 pair: TestScope; library routine
480 `TestScope({obj_id,actor})`
481 Returns :const:`true` if the `{obj_id}` is in scope, otherwise
482 :const:`false`. If the optional `{actor}` is supplied, that defines the
486 pair: TryNumber; library routine
489 Parses word `{expr}` in the input stream as a number, recognising
490 decimals, also English words one..twenty. Returns the number 1..10000,
491 or -1000 if the parse fails.
494 pair: UnsignedCompare; library routine
496 `UnsignedCompare({expr1,expr2})`
497 Returns -1 if `{expr1}` is less than `{expr2}`, 0 if `{expr1}` equals
498 `{expr2}`, and 1 if `{expr1}` is greater than `{expr2}`. Both
499 expressions are unsigned, in the range 0..65535.
502 pair: WordAddress; library routine
504 `WordAddress({expr})`
505 Returns a byte array containing the raw text of word `{expr}` in the
509 pair: WordInProperty; library routine
511 `WordInProperty({word,obj_id,property})`
512 Returns :const:`true` if the dictionary `{word}` is listed in the
513 `{property}` values for the `{obj_id}`.
516 pair: WordLength; library routine
519 Returns the length of word `{expr}` in the input stream.
522 pair: WriteListFrom; library routine
524 `WriteListFrom({obj_id,expr})`
525 Outputs a list of `{obj_id}` and its siblings, in the given style, an
526 `{expr}` formed by adding any of: `ALWAYS_BIT`, `CONCEAL_BIT`,
527 `DEFART_BIT`, `ENGLISH_BIT`, `FULLINV_BIT`, `INDENT_BIT`, `ISARE_BIT`,
528 `NEWLINE_BIT`, `PARTINV_BIT`, `RECURSE_BIT`, `TERSE_BIT`, `WORKFLAG_BIT`.
531 pair: YesOrNo; library routine
534 Returns :const:`true` if the player types "`YES`", :const:`false` for
538 pair: ZRegion; library routine
541 Returns the type of its `{arg}` : 3 for a string address, 2 for a routine
542 address, 1 for an object number, or 0 otherwise.
549 Where the `value` of a property can be a routine, several formats are
550 possible (but remember: embedded "`]`" returns :const:`false`, standalone
551 "`]`" returns :const:`true`):
553 | `{property} [; {stmt}; {stmt}; ... ]`
554 | `{property} [; return {routine_id}(); ]`
555 | `{property} [; {routine_id}(); ]`
556 | `{property} {routine_id}`
558 In this appendix, |ADD| marks an additive property. Where a `Class` and an
559 `Object` of that class both define the same property, the value specified
560 for the `Object` normally overrides the value inherited from the `Class`.
561 However, if the property is additive then both values apply, with the
562 Object's value being considered first.
565 pair: add_to_scope; library property
568 For an object: additional objects which follow it in and out of scope.
569 The `{value}` can be a space-separated list of `{obj_ids}`, or a routine
570 which invokes `PlaceInScope()` or `ScopeWithin()` to specify objects.
573 pair: after; library property
576 For an object: receives every `{action}` and `{fake_action}` for which
577 this is the `{noun}`. For a room: receives every `{action}` which occurs
580 The `{value}` is a routine of structure similar to a `switch` statement,
581 having cases for the appropriate `{actions}` (and an optional `default`
582 as well); it is invoked after the action has happened, but before the
583 player has been informed. The routine should return :const:`false` to
584 continue, telling the player what has happened, or :const:`true` to stop
585 processing the action and produce no further output.
588 pair: article; library property
591 For an object: the object's indefinite article - the default is
592 automatically "a", "an" or "some". The `{value}` can be a string, or a
593 routine which outputs a string.
596 pair: articles; library property
599 For a non-English object: its definite and indefinite articles. The
600 `{value}` is an array of strings.
603 pair: before; library property
606 For an object: receives every `{action}` and `{fake_action}` for which
607 this is the `{noun}`. For a room: receives every action which occurs
610 The `{value}` is a routine invoked before the action has happened. See
614 pair: cant_go; library property
617 For a room: the message when the player attempts an impossible exit. The
618 `{value}` can be a string, or a routine which outputs a string.
621 pair: capacity; library property
624 For a :attr:`container` or :attr:`supporter` object: the number of
625 objects which can be placed in or on it - the default is 100.
627 For the player: the number which can be carried - :obj:`selfobj` has an
628 initial capacity of `MAX_CARRIED`.
630 The `{value}` can be a number, or a routine which returns a number.
633 pair: d_to; library property
636 For a room: a possible exit. The `{value}` can be
638 * :const:`false` (the default): not an exit;
639 * a string: output to explain why this is not an exit;
640 * a `{room}`: the exit leads to this room;
641 * a :obj:`door` object: the exit leads through this door;
642 * a routine which should return :const:`false`, a string, a `{room}`, a
643 :obj:`door` object, or :const:`true` to signify "not an exit" and
644 produce no further output.
647 pair: daemon; library property
650 The `{value}` is a routine which can be activated by
651 `StartDaemon({obj_id})` and which then runs once each turn until
652 deactivated by `StopDaemon({obj_id})`.
655 pair: describe; library property
657 :prop:`describe` |ADD|
658 For an object: called before the object's description is output. For a
659 room: called before the room's (long) description is output.
661 The `{value}` is a routine which should return :const:`false` to continue,
662 outputting the usual description, or :const:`true` to stop processing and
663 produce no further output.
666 pair: description; library property
669 For an object: its description (output by `Examine`).
671 For a room: its long description (output by `Look`).
673 The `{value}` can be a string, or a routine which outputs a string.
676 pair: door_dir; library property
679 For a :obj:`compass` object (:obj:`d_obj`, :obj:`e_obj`, ...): the
680 direction in which an attempt to move to this object actually leads.
682 For a :obj:`door` object: the direction in which this door leads.
684 The `{value}` can be a directional property (:prop:`d_to`, :prop:`e_to`,
685 \...), or a routine which returns such a property.
688 pair: door_to; library property
691 For a `door` object: where it leads. The value can be
693 * :const:`false` (the default): leads nowhere;
694 * a string: output to explain why door leads nowhere;
695 * a `{room}`: the door leads to this room;
696 * a routine which should return :const:`false`, a string, a `{room}`, or
697 :const:`true` to signify "leads nowhere" without producing any output.
700 pair: e_to; library property
706 pair: each_turn; library property
708 :prop:`each_turn` |ADD|
709 Invoked at the end of each turn (after all appropriate daemons and
710 timers) whenever the object is in scope. The `{value}` can be a string,
714 pair: found_in; library property
717 For an object: the rooms where this object can be found, unless it has
718 the :attr:`absent` attribute. The `{value}` can be
720 * a space-separated list of `{rooms}` (where this object can be found) or
721 `{obj_ids}` (whose locations are tracked by this object);
722 * a routine which should return :const:`true` if this object can be found
723 in the current location, otherwise :const:`false`.
726 pair: grammar; library property
729 For an :attr:`animate` or :attr:`talkable` object: the `{value}` is a
730 routine called when the parser knows that this object is being addressed,
731 but has yet to test the grammar. The routine should return
732 :const:`false` to continue, :const::const:`true` to indicate that the
733 routine has parsed the entire command, or a dictionary word ('`word`' or
737 pair: in_to; library property
743 pair: initial; library property
746 For an object: its description before being picked up.
748 For a room: its description when the player enters the room.
750 The `{value}` can be a string, or a routine which outputs a string.
753 pair: inside_description; library property
755 :prop:`inside_description`
756 For an `enterable` object: its description, output as part of the room
757 description when the player is inside the object.
759 The `{value}` can be a string, or a routine which outputs a string.
762 pair: invent; library property
765 For an object: the `{value}` is a routine for outputting the object's
766 inventory listing, which is called twice. On the first call nothing has
767 been output; :var:`inventory_stage` has the value 1, and the routine
768 should return :const:`false` to continue, or :const:`true` to stop
769 processing and produce no further output. On the second call the
770 object's indefinite article and short name have been output, but not any
771 subsidiary information; :var:`inventory_stage` has the value 2, and the
772 routine should return :const:`false` to continue, or :const:`true` to
773 stop processing and produce no further output.
776 pair: life; library property
779 For an `animate` object: receives person-to-person actions (`Answer`,
780 `Ask`, `Attack`, `Give`, `Kiss`, `Order`, `Show`, `Tell`, `ThrowAt` and
781 `WakeOther`) for which this is the `{noun}`. The `{value}` is a routine
782 of structure similar to a `switch` statement, having cases for the
783 appropriate `{actions}` (and an optional default as well). The routine
784 should return :const:`false` to continue, telling the player what has
785 happened, or :const:`true` to stop processing the action and produce no
789 pair: list_together; library property
791 :prop:`list_together`
792 For an object: groups related objects when outputting an inventory or
793 room contents list. The `{value}` can be
795 * a `{number}`: all objects having this value are grouped;
796 * a `{string}`: all objects having this value are grouped as a count of
798 * a routine which is called twice. On the first call nothing has been
799 output; :var:`inventory_stage` has the value 1, and the routine should
800 return :const:`false` to continue, or :const::const:`true` to stop
801 processing and produce no further output. On the second call the list
802 has been output; :var:`inventory_stage` has the value 2, and there is
803 no test on the return value.
806 pair: n_to; library property
812 pair: name; library property
815 Defines a space-separated list of words which are added to the Inform
816 dictionary. Each word can be supplied in apostrophes '...' or quotes
817 "..."; in all other cases only words in apostrophes update the
820 For an object: identifies this object.
822 For a room: outputs "does not need to be referred to".
825 pair: ne_to; library property
831 pair: number; library property
834 For an object or room: the `{value}` is a general-purpose variable freely
835 available for use by the program. A :var:`player` object must provide
836 (but not use) this variable.
839 pair: nw_to; library property
845 pair: orders; library property
848 For an :attr:`animate` or :attr:`talkable` object: the `{value}` is a
849 routine called to carry out the player's orders. The routine should
850 return :const:`false` to continue, or :const:`true` to stop processing
851 the action and produce no further output.
854 pair: out_to; library property
860 pair: parse_name; library property
863 For an object: the `{value}` is a routine called to parse an object's
864 name. The routine should return zero if the text makes no sense, -1 to
865 cause the parser to resume, or the positive number of words matched.
868 pair: plural; library property
871 For an object: its plural form, when in the presence of others like it.
872 The `{value}` can be a string, or a routine which outputs a string.
875 pair: react_after; library property
878 For an object: detects nearby actions - those which take place when this
879 object is in scope. The `{value}` is a routine invoked after the action
880 has happened, but before the player has been informed. See :prop:`after`.
883 pair: react_before; library property
886 For an object: detects nearby actions - those which take place when this
887 object is in scope. The `{value}` is a routine invoked before the action
888 has happened. See :prop:`after`.
891 pair: s_to; library property
897 pair: se_to; library property
903 pair: short_name; library property
906 For an object: an alternative or extended short name. The `{value}` can
907 be a string, or a routine which outputs a string. The routine should
908 return :const:`false` to continue by outputting the object's *actual*
909 short name (from the head of the object definition), or :const:`true` to
910 stop processing the action and produce no further output.
913 pair: short_name_indef; library property
915 :prop:`short_name_indef`
916 For a non-English object: the short name when preceded by an indefinite
917 object. The `{value}` can be a string, or a routine which outputs a
921 pair: sw_to; library property
927 pair: time_left; library property
930 For a timer object: the `{value}` is a variable to hold the number of
931 turns left until this object's timer - activated and initialised by
932 `StartTimer({obj_id})` - counts down to zero and invokes the object's
936 pair: time_out; library property
939 For a timer object: the `{value}` is a routine which is run when the
940 object's :prop:`time_left` value - initialised by `StartTimer({obj_id})`,
941 and not in the meantime cancelled by `StopTimer({obj_id})` - counts down
945 pair: u_to; library property
951 pair: w_to; library property
957 pair: when_closed; library property
962 pair: when_open; library property
965 For a :attr:`container` or :attr:`door` object: used when including this
966 object in a room's long description. The `{value}` can be a string, or a
967 routine which outputs a string.
970 pair: when_off; library property
975 pair: when_on; library property
978 For a :attr:`switchable` object: used when including this object in a
979 room's long description. The `{value}` can be a string, or a routine
980 which outputs a string.
983 pair: with_key; library property
986 For a :attr:`lockable` object: the `{obj_id}` (generally some kind of
987 key) needed to lock and unlock the object, or :const:`nothing` if no key
996 pair: absent; library attribute
999 For a floating object (one with a :prop:`found_in` property, which can
1000 appear in many rooms): is no longer there.
1003 pair: animate; library attribute
1006 For an object: is a living creature.
1009 pair: clothing; library attribute
1012 For an object: can be worn.
1015 pair: concealed; library attribute
1018 For an object: is present but hidden from view.
1021 pair: container; library attribute
1024 For an object: other objects can be put in (but not on) it.
1027 pair: door; library attribute
1030 For an object: is a door or bridge between rooms.
1033 pair: edible; library attribute
1036 For an object: can be eaten.
1039 pair: enterable; library attribute
1042 For an object: can be entered.
1045 pair: female; library attribute
1048 For an :attr:`animate` object: is female.
1051 pair: general; library attribute
1054 For an object or room: a general-purpose flag.
1057 pair: light; library attribute
1060 For an object or room: is giving off light.
1063 pair: lockable; library attribute
1066 For an object: can be locked; see the :prop:`with_key` property.
1069 pair: locked; library attribute
1072 For an object: can't be opened.
1075 pair: male; library attribute
1078 For an :attr:`animate` object: is male.
1081 pair: moved; library attribute
1084 For an object: is being, or has been, taken by the player.
1087 pair: neuter; library attribute
1090 For an :attr:`animate` object: is neither male nor female.
1093 pair: on; library attribute
1096 For a :attr:`switchable` object: is switched on.
1099 pair: open; library attribute
1102 For a :attr:`container` or door object: is open.
1105 pair: openable; library attribute
1108 For a :attr:`container` or :attr:`door` object: can be opened.
1111 pair: pluralname; library attribute
1114 For an object: is plural.
1117 pair: proper; library attribute
1120 For an object: the short name is a proper noun, therefore not to be
1121 preceded by "The" or "the".
1124 pair: scenery; library attribute
1127 For an object: can't be taken; is not listed in a room description.
1130 pair: scored; library attribute
1133 For an object: awards `OBJECT_SCORE` points when taken for the first
1134 time. For a room: awards `ROOM_SCORE` points when visited for the
1138 pair: static; library attribute
1141 For an object: can't be taken.
1144 pair: supporter; library attribute
1147 For an object: other objects can be put on (but not in) it.
1150 pair: switchable; library attribute
1153 For an object: can be switched off or on.
1156 pair: talkable; library attribute
1159 For an object: can be addressed in "object, do this" style.
1162 pair: transparent; library attribute
1165 For a :attr:`container` object: objects inside it are visible.
1168 pair: visited; library attribute
1171 For a room: is being, or has been, visited by the player.
1174 pair: workflag; library attribute
1177 Temporary internal flag, also available to the program.
1180 pair: worn; library attribute
1183 For a :attr:`clothing` object: is being worn.
1187 Optional entry points
1188 =====================
1190 These routines, if you supply them, are called when shown.
1193 Player has died; `deadflag=0` resurrects.
1196 The ">" prompt has been output.
1199 Player has won; `AMUSING_PROVIDED` is defined.
1202 The parser has input some text, set up the buffer and parse tables, and
1203 initialised :var:`wn` to 1.
1205 `ChooseObjects({object,flag})`
1206 Parser has found "`ALL`" or an ambiguous noun phrase and decided that
1207 `{object}` should be excluded (`flag` is 0), or included (`flag` is 1).
1208 The routine should return 0 to let this stand, 1 to force inclusion, or 2
1209 to force exclusion. If `flag` is 2, parser is undecided; routine should
1210 return appropriate score 0..9.
1213 The player has gone from one dark room to another.
1216 The player has died; `deadflag` is 3 or more.
1219 Called after all actions.
1222 Called before all actions.
1225 **Mandatory; note British spelling**: called at start. Must set
1226 `location`; can return 2 to suppress game banner.
1229 Called during parsing.
1232 Called at the end of every `Look` description.
1235 Called when room changes, before description is output.
1237 `ParseNoun({object})`
1238 Called to parse the `{object}`\'s name.
1240 `ParseNumber({byte_array,length})`
1241 Called to parse a number.
1243 `ParserError({number})`
1244 Called to handle an error.
1247 Completes the output of the score.
1249 `PrintTaskName({number})`
1250 Prints the name of the task.
1253 Called when an unusual verb is printed.
1256 Called after every turn.
1259 Called when an unusual verb is encountered.
1261 .. _group-1-actions:
1266 Group 1 actions support the 'meta' verbs. These are the standard actions
1267 and their triggering verbs.
1269 ============== =====================================================
1270 `CommandsOff` "`RECORDING OFF`"
1271 `CommandsOn` "`RECORDING [ON]`"
1272 `CommandsRead` "`REPLAY`"
1273 `FullScore` "`FULLSCORE`", "`FULL [SCORE]`"
1274 `LMode1` "`BRIEF`", "`NORMAL`"
1275 `LMode2` "`LONG`", "`VERBOSE`"
1276 `LMode3` "`SHORT`", "`SUPERBRIEF`"
1277 `NotifyOff` "`NOTIFY OFF`"
1278 `NotifyOn` "`NOTIFY [ON]`"
1279 `Objects` "`OBJECTS`"
1281 `Pronouns` "`[PRO]NOUNS`"
1282 `Quit` "`DIE`", "`Q[UIT]`"
1283 `Restart` "`RESTART`"
1284 `Restore` "`RESTORE`"
1287 `ScriptOff` "`[TRAN]SCRIPT OFF`", "`NOSCRIPT`", "`UNSCRIPT`"
1288 `ScriptOn` "`[TRAN]SCRIPT [ON]`"
1290 `Version` "`VERSION`"
1291 ============== =====================================================
1293 and the debug tools.
1295 =============== ===================================================
1296 `ActionsOff` "`ACTIONS OFF`"
1297 `ActionsOn` "`ACTIONS [ON]`"
1298 `ChangesOff` "`CHANGES OFF`"
1299 `ChangesOn` "`CHANGES [ON]`"
1302 `Predictable` "`RANDOM`"
1303 `RoutinesOff` "`MESSAGES OFF`", "`ROUTINES OFF`"
1304 `RoutinesOn` "`MESSAGES [ON]`", "`ROUTINES [ON]`"
1306 `Showobj` "`SHOWOBJ`"
1307 `Showverb` "`SHOWVERB`"
1308 `TimersOff` "`DAEMONS OFF`", "`TIMERS OFF`"
1309 `TimersOn` "`DAEMONS [ON]`", "`TIMERS [ON]`"
1310 `TraceLevel` "`TRACE number`"
1311 `TraceOff` "`TRACE OFF`"
1312 `TraceOn` "`TRACE [ON]`"
1313 `XAbstract` "`ABSTRACT`"
1314 `XPurloin` "`PURLOIN`"
1316 =============== ===================================================
1318 .. _group-2-actions:
1323 Group 2 actions usually work, given the right circumstances.
1325 .. tabularcolumns:: |l|p{5in}|
1327 ============= =============================================================
1328 `Close` "`CLOSE [UP]`", "`COVER [UP]`", "`SHUT [UP]`"
1329 `Disrobe` "`DISROBE`", "`DOFF`", "`REMOVE`", "`SHED`", "`TAKE OFF`"
1330 `Drop` "`DISCARD`", "`DROP`", "`PUT DOWN`", "`THROW`"
1332 `Empty` "`EMPTY [OUT]`"
1333 `EmptyT` "`EMPTY IN|INTO|ON|ONTO|TO`"
1334 `Enter` "`CROSS`", "`ENTER`", "`GET IN|INTO|ON|ONTO`",
1335 "`GO IN|INSIDE|INTO|THROUGH`",
1336 "`LEAVE IN|INSIDE|INTO|THROUGH`", "`LIE IN|INSIDE|ON`",
1338 "`RUN IN|INSIDE|INTO|THROUGH`", "`SIT IN|INSIDE|ON`",
1339 "`SIT ON TOP OF`", "`STAND ON`",
1340 "`WALK IN|INSIDE|INTO|THROUGH`"
1341 `Examine` "`CHECK,`" "`DESCRIBE`", "`EXAMINE`",
1342 "`L[OOK] AT`", "`READ`", "`WATCH`", "`X`"
1343 `Exit` "`EXIT`", "`GET OFF|OUT|UP`",
1344 "`LEAVE`", "`OUT[SIDE]`", "`STAND [UP]`"
1345 `GetOff` "`GET OFF`"
1346 `Give` "`FEED [TO]`", "`GIVE [TO]`", "`OFFER [TO]`", "`PAY [TO]`"
1347 `Go` "`GO`", "`LEAVE`", "`RUN`", "`WALK`"
1348 `GoIn` "`CROSS`", "`ENTER`", "`IN[SIDE]`"
1349 `Insert` "`DISCARD IN|INTO`",
1350 "`DROP DOWN|IN|INTO`",
1352 "`PUT IN|INSIDE|INTO`",
1353 "`THROW DOWN|IN|INTO`"
1354 `Inv` "`I[NV]`", "`INVENTORY`", "`TAKE INVENTORY`"
1355 `InvTall` "`I[NV] TALL`", "`INVENTORY TALL`"
1356 `InvWide` "`I[NV] WIDE`", "`INVENTORY WIDE`"
1357 `Lock` "`LOCK WITH`"
1359 `Open` "`OPEN`", "`UNCOVER`", "`UNDO`", "`UNWRAP`"
1360 `PutOn` "`DISCARD ON|ONTO`",
1364 `Remove` "`GET FROM`", "`REMOVE FROM`", "`TAKE FROM|OFF`"
1365 `Search` "`L[OOK] IN|INSIDE|INTO|THROUGH`", "`SEARCH`"
1366 `Show` "`DISPLAY [TO]`", "`PRESENT [TO]`", "`SHOW [TO]`"
1367 `SwitchOff` "`CLOSE OFF`", "`SCREW OFF`",
1368 "`SWITCH OFF`", "`TURN OFF`",
1370 `SwitchOn` "`SCREW ON`", "`SWITCH ON`",
1371 "`TURN ON`", "`TWIST ON`"
1372 `Take` "`CARRY`", "`GET`", "`HOLD`",
1373 "`PEEL [OFF]`", "`PICK UP`",
1374 "`REMOVE`", "`TAKE`"
1375 `Transfer` "`CLEAR TO`", "`MOVE TO`",
1376 "`PRESS TO`", "`PUSH TO`",
1377 "`SHIFT TO`", "`TRANSFER TO`"
1378 `Unlock` "`OPEN WITH`", "`UNDO WITH`",
1380 `VagueGo` "`GO`", "`LEAVE`", "`RUN`", "`WALK`"
1381 `Wear` "`DON`", "`PUT ON`", "`WEAR`"
1382 ============= =============================================================
1384 .. _group-3-actions:
1389 Group 3 actions are by default stubs which output a message and stop at the
1390 "before" stage (so there is no "after" stage).
1392 .. tabularcolumns:: |l|p{5in}|
1394 ============= =============================================================
1395 `Answer` "`ANSWER TO`", "`SAY TO`",
1396 "`SHOUT TO`", "`SPEAK TO`"
1398 `AskFor` "`ASK FOR`"
1399 `Attack` "`ATTACK`", "`BREAK`", "`CRACK`",
1400 "`DESTROY`", "`FIGHT`", "`HIT`",
1401 "`KILL`", "`MURDER`", "`PUNCH`",
1402 "`SMASH`", "`THUMP`", "`TORTURE`",
1405 `Burn` "`BURN [WITH]`", "`LIGHT [WITH]`"
1406 `Buy` "`BUY`" "`PURCHASE`"
1407 `Climb` "`CLIMB [OVER|UP]`", "`SCALE`"
1408 `Consult` "`CONSULT ABOUT|ON`",
1410 "`READ ABOUT IN`", "`READ IN`"
1411 `Cut` "`CHOP,`" "`CUT`", "`PRUNE`", "`SLICE`"
1412 `Dig` "`DIG [WITH]`"
1413 `Drink` "`DRINK`", "`SIP`", "`SWALLOW`"
1415 `Jump` "`HOP`", "`JUMP`", "`SKIP`"
1416 `JumpOver` "`HOP OVER`", "`JUMP OVER`", "`SKIP OVER`"
1417 `Kiss` "`EMBRACE`", "`HUG`", "`KISS`"
1418 `Listen` "`HEAR`", "`LISTEN [TO]`"
1419 `LookUnder` "`LOOK UNDER`"
1420 `Mild` Various mild swearwords.
1423 `Pull` "`DRAG`" "`PULL`"
1424 `Push` "`CLEAR`", "`MOVE`", "`PRESS`",
1426 `PushDir` "`CLEAR`", "`MOVE`", "`PRESS`",
1428 `Rub` "`CLEAN`", "`DUST`", "`POLISH`",
1429 "`RUB`", "`SCRUB`", "`SHINE`",
1431 `Set` "`ADJUST`", "`SET`"
1432 `SetTo` "`ADJUST TO`", "`SET TO`"
1434 `Sleep` "`NAP`", "`SLEEP`"
1435 `Smell` "`SMELL`", "`SNIFF`"
1437 `Squeeze` "`SQUASH`", "`SQUEEZE`"
1438 `Strong` Various strong swearwords.
1439 `Swim` "`DIVE`", "`SWIM`"
1440 `Swing` "`SWING [ON]`"
1442 `Tell` "`TELL ABOUT`"
1444 `ThrowAt` "`THROW AGAINST|AT|ON|ONTO`"
1445 `Tie` "`ATTACH [TO]`", "`FASTEN [TO]`",
1446 "`FIX [TO]`", "`TIE [TO]`"
1447 `Touch` "`FEEL,`" "`FONDLE`", "`GROPE`", "`TOUCH`"
1448 `Turn` "`ROTATE`", "`SCREW`", "`TURN`",
1449 "`TWIST`", "`UNSCREW`"
1450 `Wait` "`WAIT`" "`Z`"
1451 `Wake` "`AWAKE[N]`", "`WAKE [UP]`"
1452 `WakeOther` "`AWAKE[N]`", "`WAKE [UP]`"
1454 `WaveHands` "`WAVE`"
1456 ============= =============================================================
1461 Fake actions handle some special cases, or represent "real" actions from
1462 the viewpoint of the second object.
1464 .. tabularcolumns:: |l|p{5in}|
1466 ================ ========================================================
1467 `LetGo` Generated by `Remove`.
1468 `ListMiscellany` Outputs a range of inventory messages.
1469 `Miscellany` Outputs a range of utility messages.
1470 `NotUnderstood` Generated when parser fails to interpret some `orders`.
1471 `Order` Receives things not handled by `orders`.
1472 `PluralFound` Tells the parser that `parse_name()` has identified a
1474 `Prompt` Outputs the prompt, normally ">".
1475 `Receive` Generated by `Insert` and `PutOn`.
1476 `TheSame` Generated when parser can't distinguish between two
1478 `ThrownAt` Generated by `ThrowAt`.
1479 ================ ========================================================