Equipment List

Example 177
★★

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

Most of the phrase options above are relatively self-explanatory; a few are less so. Here is an overview:

"With newlines" tells Inform to put a new line before each listed object. Indented tells it to indent contents of objects, when listing these.

"Giving inventory information" means to append information such as (closed) or (being worn) to objects.

"As a sentence" means to put "and" before the last object and commas between them; this is usually not used in conjunction with newline listing. "As a sentence" obeys whatever conventions about the use of the serial comma we may have established with the "Use serial comma" option.

"Including contents" means to list the contents of open or transparent containers and all supporters, whereas including all contents means to list the contents of all containers, even opaque closed ones.

"Tersely", perhaps unexpectedly, puts parentheses around objects listed as the contents of other objects.

"Giving brief inventory information" omits most of the inventory tags, such as "(open)" and "(worn)", but does list "(closed)" for closed containers which might not otherwise be obviously openable.

"Using the definite article" means prefixing objects with "the", if applicable, rather than "a".

"Listing marked items only" means including only objects that have already been declared "marked for listing".

"Prefacing with is-are" means that Inform will write "is" before the list if it contains only one item, and "are" if the list contains more than one.

"Not listing concealed items" means to omit from the list anything which is scenery.

Finally, "with extra indentation" means that the whole list should be indented slightly, in emulation of the default inventory listing.

With this information, we can try rewriting the inventory behavior to emulate the standard or to explore alternate versions:

"Equipment List"
The Watery Room is a room. The player carries a snorkel and a waterproof sack. The waterproof sack contains an undersea map, a diving guide, a cup, and 500 Argentine pesos. The cup contains a worm. The player wears a swimsuit and a pair of flippers. The sack is openable and open.
Inventory listing style is a kind of value. The inventory listing styles are tall, wide, curt, minimal, divided tall, and divided wide. Current inventory listing style is an inventory listing style that varies.
Understand "inventory [inventory listing style]" as requesting styled inventory. Requesting styled inventory is an action applying to an inventory listing style. It is an action out of world.
Carry out requesting styled inventory:
   now current inventory listing style is the inventory listing style understood.
Report requesting styled inventory:
   say "Inventory listing is now set to [current inventory listing style]."

We begin by emulating the standard inventory listing style:

Instead of taking inventory when current inventory listing style is tall:
   if the number of things enclosed by the player is 0, say "You are empty-handed." instead;
   say "You are carrying: [line break]";
   list the contents of the player, with newlines, indented, giving inventory information, including contents, with extra indentation.

Here we offer the alternative of listing everything together as a paragraph:

Instead of taking inventory when current inventory listing style is wide:
   if the number of things enclosed by the player is 0, say "You are empty-handed." instead;
   say "You are carrying ";
   list the contents of the player, giving inventory information, as a sentence, including contents;
   say "."

This may be unsatisfactory, however. Items that are inside other items are not set off from those merely carried by the player. One way around this is to use terse listing, giving such descriptions as "a waterproof sack (in which are an undersea map, a diving guide, a cup (in which is a worm) and a 500 Argentine pesos)" as opposed to the more confusing " a waterproof sack (open), inside which are an undersea map, a diving guide, a cup, inside which is a worm and a 500 Argentine pesos".

Instead of taking inventory when current inventory listing style is curt:
   if the number of things enclosed by the player is 0, say "You are empty-handed." instead;
   say "You are carrying ";
   list the contents of the player, tersely, giving brief inventory information, as a sentence, including contents;
   say "."

If, using the above style, we close the sack, we will still get "(closed)" after the sack's listing. The following minimalist listing style abolishes even that nicety:

Instead of taking inventory when current inventory listing style is minimal:
   if the number of things enclosed by the player is 0, say "You are empty-handed." instead;
   say "You are carrying ";
   list the contents of the player, tersely, as a sentence, including contents;
   say "."

If we want to list worn things separately from carried things, we have occasion to put "listing marked items only" to work:

Instead of taking inventory when the current inventory listing style is divided wide:
   if the number of things enclosed by the player is 0, say "You are empty-handed." instead;
   say "You are wearing ";
   now all things enclosed by the player are unmarked for listing;
   now all things worn by the player are marked for listing;
   if no things worn by the player are marked for listing, say "nothing";
   otherwise list the contents of the player, as a sentence, listing marked items only;
   say ".[paragraph break]";
   say "You are carrying ";
   now all things carried by the player are marked for listing;
   now all things worn by the player are unmarked for listing;
   if no things carried by the player are marked for listing, say "nothing";
   otherwise list the contents of the player, as a sentence, tersely, giving brief inventory information, listing marked items only;
   say ".[paragraph break]".

And similarly for a tall divided inventory:

Instead of taking inventory when the current inventory listing style is divided tall:
   if the number of things enclosed by the player is 0, say "You are empty-handed." instead;
   if the player carries something:
      now all things enclosed by the player are unmarked for listing;
      now all things carried by the player are marked for listing;
      say "You are carrying: [line break]";
      list the contents of the player, with newlines, indented, giving inventory information, including contents, with extra indentation, listing marked items only;
   if the player wears something:
      now all things enclosed by the player are unmarked for listing;
      now all things worn by the player are marked for listing;
      say "You are wearing: [line break]";
      list the contents of the player, with newlines, indented, including contents, with extra indentation, listing marked items only.
Test me with "i / inventory wide / i / inventory curt / i / close sack / i / open sack / inventory minimal / i / close sack / i / open sack / inventory divided wide / i / inventory divided tall / i / drop all / i / take all / take off swimsuit / take off flippers / i / i divided wide / i / wear swimsuit / drop all / i".
Test me with "i / inventory wide / i / inventory curt / i / close sack / i / open sack / inventory minimal / i / close sack / i / open sack / inventory divided wide / i / inventory divided tall / i / drop all / i / take all / take off swimsuit / take off flippers / i / i divided wide / i / wear swimsuit / drop all / i".
Watery Room

>(Testing.)

>[1] i
You are carrying:
a snorkel
a waterproof sack (open)
an undersea map
a diving guide
a cup
a worm
500 Argentine pesos
a swimsuit (being worn)
a pair of flippers (being worn)

>[2] inventory wide
Inventory listing is now set to wide.

>[3] i
You are carrying a snorkel, a waterproof sack (open), inside which are an undersea map, a diving guide, a cup, inside which is a worm and 500 Argentine pesos, a swimsuit (being worn) and a pair of flippers (being worn).

>[4] inventory curt
Inventory listing is now set to curt.

>[5] i
You are carrying a snorkel, a waterproof sack (in which are an undersea map, a diving guide, a cup (in which is a worm) and 500 Argentine pesos), a swimsuit and a pair of flippers.

>[6] close sack
You close the waterproof sack.

>[7] i
You are carrying a snorkel, a waterproof sack (closed), a swimsuit and a pair of flippers.

>[8] open sack
You open the waterproof sack, revealing an undersea map, a diving guide, a cup and 500 Argentine pesos.

>[9] inventory minimal
Inventory listing is now set to minimal.

>[10] i
You are carrying a snorkel, a waterproof sack (in which are an undersea map, a diving guide, a cup (in which is a worm) and 500 Argentine pesos), a swimsuit and a pair of flippers.

>[11] close sack
You close the waterproof sack.

>[12] i
You are carrying a snorkel, a waterproof sack, a swimsuit and a pair of flippers.

>[13] open sack
You open the waterproof sack, revealing an undersea map, a diving guide, a cup and 500 Argentine pesos.

>[14] inventory divided wide
Inventory listing is now set to divided wide.

>[15] i
You are wearing a swimsuit and a pair of flippers.

You are carrying a snorkel and a waterproof sack.

>[16] inventory divided tall
Inventory listing is now set to divided tall.

>[17] i
You are carrying:
a snorkel
a waterproof sack (open)
an undersea map
a diving guide
a cup
a worm
500 Argentine pesos
You are wearing:
a swimsuit
a pair of flippers

>[18] drop all
snorkel: Dropped.
waterproof sack: Dropped.

>[19] i
You are wearing:
a swimsuit
a pair of flippers

>[20] take all
waterproof sack: Taken.
snorkel: Taken.
undersea map: Taken.
diving guide: Taken.
cup: Taken.
worm: Taken.
500 Argentine pesos: Taken.

>[21] take off swimsuit
You take off the swimsuit.

>[22] take off flippers
You take off the pair of flippers.

>[23] i
You are carrying:
500 Argentine pesos
a worm
a cup
a diving guide
an undersea map
a snorkel
a waterproof sack (open but empty)
a swimsuit
a pair of flippers

>[24] i divided wide
Inventory listing is now set to divided wide.

>[25] i
You are wearing nothing.

You are carrying 500 Argentine pesos, a worm, a cup (empty), a diving guide, an undersea map, a snorkel, a waterproof sack (empty), a swimsuit and a pair of flippers.

>[26] wear swimsuit
You put on the swimsuit.

>[27] drop all
500 Argentine pesos: Dropped.
worm: Dropped.
cup: Dropped.
diving guide: Dropped.
undersea map: Dropped.
snorkel: Dropped.
waterproof sack: Dropped.
pair of flippers: Dropped.

>[28] i
You are wearing a swimsuit.

You are carrying nothing.