§11.14. Phrase options

There are sometimes several slightly different ways to perform a given task but which have substantially the same definition. In the following example:

To go hiking, into the woods or up the mountain:
    if into the woods, say "Watch out for badgers.";
    if up the mountain, say "Better take your compass.";
    say "You go hiking."

...a phrase has been set up which can be used in three ways:

go hiking;
go hiking, into the woods;
go hiking, up the mountain;

Note that commas must be used to divide these "phrase options" from the rest of the text of the phrase. Within the definition of the phrase, the option's name is a valid condition, and

if up the mountain, ...

tests whether it is set; we can also test if it is not set using:

if not up the mountain, ...

A more substantial example from the Standard Rules is given by a phrase used mostly for internal, technical reasons:

list the contents of (object)

This phrase produces a list of all things whose holder is the given object, according to Inform's traditional conventions for room descriptions and inventory listings. Example:

list the contents of Marley Wood, as a sentence, with newlines
and including all contents;

Where this is possible, it's generally better to use "[list of things in ...]" instead, which produces the same result in an acceptable way for the middle of a sentence.

Note that this phrase is allowed to have multiple options specified, whereas "go hiking" above was not: this is because it was defined thus:

To list the contents of (something - an object), with newlines, indented, as a sentence, including contents, including all contents, giving inventory information, giving brief inventory information, using the definite article, listing marked items only, prefacing with is/are, not listing concealed items, suppressing all articles and/or with extra indentation: ...

The significant difference is the word "and/or" instead of "or", which signals that more than one option can apply at a time.


arrow-up.pngStart of Chapter 11: Phrases
arrow-left.pngBack to §11.13. Stop
arrow-right.pngOnward to §11.15. Let and temporary variables

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:

paste.png "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".

**ExampleEquipment List
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:

paste.png "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".

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:

paste.png "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".