Chapter 6: Commands
6.7. Inventory

Occasionally we would like to change the way the name of something is printed as part of our inventory, and we can do this with a printing the name rule such as

Rule for printing the name of the dead rat while taking inventory:
    say "dead rat (at arm's length)"

There are also several possibilities for redesigning the inventory list as a whole. INVENTORY listing with separate carried and worn items shows how to divide an inventory list into two parts, a "You are carrying: " section and a "You are wearing: " section. Equipment List goes further, and shows how we might use Inform's specialized listing functions to create a variety of differently formatted inventories.

Sometimes the way Inform by default lists properties such as "(closed)" or "(open but empty)" isn't quite what we want. Oyster Wide Shut offers a flexible alternative to the standard behavior, allowing finer control over which properties are listed and how they are described.

Trying Taking Manhattan replaces the inventory behavior for other characters: instead of silently looking through their possessions (but not describing them to the player), they now describe to the player what they're carrying and wearing.


177
** Example  Equipment List
Overview of all the phrase options associated with listing, and examples of how to change the inventory list into some other standard formats.

WI
64
*** Example  Persephone
Separate the player's inventory listing into two parts, so that it says "you are carrying..." and then (if the player is wearing anything) "You are also wearing...".

WI
414
* Example  Oyster Wide Shut
Replacing Inform's default printing of properties such as "(closed)", "(open and providing light)", etc., with our own, more flexible variation.

WI
204
*** Example  Trying Taking Manhattan
Replacing the inventory reporting rule with another which does something slightly different.

WI

Inform has built-in commands for other people, and sometimes we may want to adjust the way these work without completely disabling and replacing the command. Suppose, for instance, that instead of

Kermit the Frog looks through his possessions.

we'd like someone taking inventory to report what he's got, thus:

Kermit the Frog says, "I seem to be carrying a microphone and wearing a hat and a trenchcoat."

To do this, we could replace the built-in report rule with a different one.

"Trying Taking Manhattan"

The loud inventory rule is listed instead of the report other people taking inventory rule in the report taking inventory rules.

This is the loud inventory rule:
    unless the player is the person asked:
        say "[The person asked] says, 'I seem to be carrying [a list of things carried by the person asked][if the person asked is wearing something] and wearing [a list of things worn by the person asked][end if].'"

Persuasion rule for asking someone to try doing something: persuasion succeeds.

Grand Central Station is a room. "Here you are in New York, New York. Any minute now someone is going to burst into song."

Kermit the Frog is a man in Grand Central Station. "Kermit the Frog stands nearby, enjoying being green." Kermit is wearing a hat and a trenchcoat. He is carrying a microphone.

Test me with "inventory / kermit, inventory".


PreviousContentsNext