version 3 by Jon Ingold
Provides a wide, prose-style, customisable inventory listing, of the following form:
You are carrying a briefcase and a lemon, and wearing the old top hat. In the briefcase is a folder of papers. The folder of papers contains a map of Slovakia.
This works by printing objects directly carried and worn first (if there are any). It then runs an activity on any objects one level lower, called the "inventory listing the contents of" activity. By default this will provide the "In the briefcase..." style sentence above, but it can be customised:
Rule for inventory listing the contents of the folder of papers: say ". The folder of papers contains [list of things in the folder of papers]";
Note the period at the start of the rule's output, and the lack of one at the end.
Should we want to suppress something's contents from an inventory listing, use a "do nothing rule":
Rule for inventory listing the contents of the lemon: do nothing instead.
Note, that this will produce a list of the contents of the contents of the lemon (so it may append "In the pips of the lemon is the genetic material necessary for a new lemon tree"). To eradicate this, give the lemon's contents the "mentioned" property:
Rule for inventory listing the contents of the lemon:
now everything enclosed by the lemon is mentioned; do nothing instead.
A final note: the extension automatically describes containers and supporters, and considers anything which contains a component part, but by default this third type of object prints nothing (since most of the time printing the parts of an object is unhelpful). This does provide an entry-point should you want an object to comment on its parts:
Rule for inventory listing the contents of the ring-tailed lemur:
say ". The lemur's extraordinary tail is coiled around your neck";
...and should any of those parts be containers or supporters themselves, they will be considered even if the part itself it ignored. (Therefore a player wearing a coat with a deep pocket should be told he is wearing the jacket, and the contents of the pocket will be listed, without being told separately that the pocket is part of the coat).
Note the extension provides one relation and two adjectives: "empty" and "non-empty" describe containers and supporters appropriately, and other things will be declared non-empty if and only if they have no component parts. (But a supporter with component parts may be empty if there is nothing on it). The relation is called "encasement" and describes direct enclosure. (That is, containment, carrying, wearing, or incorporation).