"Lister.h" and "Lister2.h" contain my idea of an extension to the WriteListFrom() routine. "LTest.inf" is a demo program to exercise the routine. You can switch between Graham Nelsons 'classical' WriteListfrom and my new version using the verbs 'newlist' and 'oldlist'. I've also included code from Robert M. Dickau's "Listless": you can use the 'search' (alias 'xx') verb to display the contents of any object in an user-defined style. 'search' without an argument will list the contents of the current location. You can set the individual style bits using the 'set' and 'unset' verbs, e.g. 'set newline' or 'clear terse'. The 'style' verb will list all possible bits, and whether they're currently set or not. Note that the style bits just apply to the 'search' verb, other uses of "WriteListFrom()" (e.g. 'inventory') remain unaffected. ---------------------------------------------------------------------------- What does my WriteListFrom do which the standard Inform library doesn't? For containers and supporters, the text that is printed after the contents have been listed is now customizable using "LibraryMessages". This is useful for non-english languages, e.g. german, where the message (containing ...) should be rendered as (welcher ... enth@:alt) The value of the "short_name_case" variable is saved before recursing into a container or supporter, and restored after the contents have been printed, so the contained items may have a different inflection than the main list. Again, useful for german (and maybe other non-english languages). The same applies when objects are listed under control of "list_together". You can control the way a room, container or supporter lists its contents, by specifying a "lister_kind" property. The value of the property must be an object of class "Lister". If you define the constant "TOGETHER_OBJECT", the value of the "list_together" property of any object may also be an object of class "Lister". When you do this, you must take care if your're using small integers as "list_together" values, because such an integer might be interpreted as an object. For this reason, this possibility is disabled by default. I've found that I could do most of the things I wanted using just a WriteListFrom() routine. I've defined some new LibraryMessages texts, all of them under ##ListMiscellany. To avoid clashes with the standard Inform library, my new messages have numbers greater than 1000. If any of your objects has a 'describe' routine which doesn't print anything (to suppress listing an object in a room description), then the routine should return the value '2' in this case. When a 'describe' routine returns '2', pronouns won't be changed to refer to this object, and the 'Look' will not print the "also" in "There are also xxx here". ---------------------------------------------------------------------------- To use the new WriteListFrom: Variant One: don't change the Library source: Before including "Verblib", insert the statements Replace WriteListFrom; Replace ListRecurs; Replace Locale; into your source file. After the include of "Verblib", you have to Include "Lister"; The "WriteListFromNew" and "Locale" routines from "Lister2.h" show what your replacement routines should look like. If you include "Lister2.h" unchanged, you'll have to set the variable "use_new_writelist" to true somewhere in your initialisation routine. Furthermore, your "LibraryMessages" object must provide texts for ##ListMiscellany, numbers >1000. See "LTest.inf" for an example. Variant Two: Change the library source In Verblib.h Replace WriteListFrom, ListRecurs, Locale by their new versions (from "Lister2.h") Copy the entire "lister.h". Delete WriteBeforeEntry, WriteListR, WriteAfterEntry. In german.h oder english.h: Insert new message texts (copy from "Lister2.h") ---------------------------------------------------------------------------- The following global variables are defined: list_many When printing messages for a container or supporter, it is set to 1 if the container/supporter contains just one listable object, or to a value greater than one, if it contains more. When printing the introductory message to a "list_together" group, list_many contains the number of objects listed together. list_left Contains the number of objects still to be printed in the current list. An object of kind 'lister' has the following properties: List__MiscMessage[ id parm; ]; normally produces the Message( ##Miscellany, id, parm). You can override this, if you want your own messages. number provides the 'base' number for container/supporter related messages. Message 'number' is produced before listing all children, and 'number+1' afterwards. If the TERSE_BIT is set, messages 'number+2' and 'number+3' are used instead. List__R[ .... ]; What used to be the main body of "WriteListFrom". I haven't dared to change too many things there. List__BeforeEntry [ o depth; ]; Prepares printing the object o. Prints indentation, and so on. List__SingleEntry[ obj; ]; Responsible for printing the name of 'obj'. List__MultipleEntry[ obj nr; ]; Like "List__SingleEntry", but used for "nr" identical objects, e.g. 'five eggs'. List__AfterEntry [ o depth stack_p; ]; Determines what else is to be printed after the object name has been printed. May call "List__Partinv", "List__Fullinv" or "List__Noinv", as well as "ListRecurse", depending on listing style and object kind. List__Partinv [ o; ]; List__Fullinv [ o; ]; List__NoInv [ o; ]; Print qualifiying text for the object "o", e.g. '(providing light)'. Which of the routines is used depends on the settings of the PARTINV_BIT and FULLINV_BIT. List__Glue[ nprinted; ]; Prints the text between two items listed, for example ", " or "and". The global variable "list_left" contains the number of *unprinted* items. List__Recurse [ obj child depth stack_p; Handles printing the contents of object 'obj'. List__Locale Called by the "Locale" routine, to print the current room description. ---------------------------------------------------------------------------- Known Bugs/Things to do: The indentation style is a mixture of Graham Nelson's style (his own code) and my own. If you have an unlit lamp, and a lit lamp, and both are in the same place, and the current room is lit independetly of the lamps, they will be listed as "a lamp and a lamp" instead of "two lamps". (This also happens in the original Inform library.) I haven't dared changing parts of Graham's code, where I didn't fully understand what's happening. I'm not sure if I have provided to many different LibraryMessages, or not enough of them. Better documentation! ---------------------------------------------------------------------------- Have Fun, Andreas Andreas Hoppler (andreas.hoppler@logon.ch) Zürich, Switzerland