§12.17. Visible vs touchable vs carried

To recap, actions are created like so:

Photographing is an action applying to one visible thing and requiring light.
Depositing it in is an action applying to two things.
Taking inventory is an action applying to nothing.

Actions can involve up to two different things. We can place additional requirements on any of these things by describing them as a "visible thing", "touchable thing" or "carried thing". (If we simply say "thing" or "things", as in the second example, Inform assumes the requirement to be "touchable".) These three conditions are increasingly strong:

- To be "visible", something needs only to be possible to refer to by the player, which in practice means that it must be visible to the player-character. The noun or second noun produced by any action resulting from a command at the keyboard will always satisfy this minimal condition.

- To be "touchable", the player-character must be able to physically touch the thing in question: this normally means that it must be in the same room, and there must be no physical barriers in between.

- To be "carried", the player-character must (directly) carry the thing in question. (But if the player types a command using an action requiring something "carried", like WEAR HAT, the thing in question - the hat - will sometimes be picked up automatically. This is called "implicit taking", and results in text like "(first taking the top hat)" being printed.)

If an action involves two things, they need not have the same requirement as each other:

Waving it at is an action applying to one carried thing and one visible thing.

Thus to "wave magic wand at banyan tree", the player must be holding the wand, but need only be able to see the tree.

Note one special case. Requirements on touchability are waived in the case of "try" actions applied to people other than the player where the things they would need to touch are doors or backdrops. (This is a compromise to avoid difficulties arising from the ambiguous locations of such items.)


arrow-up.pngStart of Chapter 12: Advanced Actions
arrow-left.pngBack to §12.16. Reaching inside and reaching outside rules
arrow-right.pngOnward to §12.18. Changing reachability

**ExampleEddystone
Creating new commands involving the standard compass directions.

Under most circumstances, locking and unlocking require the player to be carrying the key he uses to unlock something. This makes sense -- unless the key is on a keychain, or on a chain around his neck, for instance. So here we explore one way to circumstantially override the carrying requirements, while still making sure that the player cannot unlock the door if the unlocking tool is nowhere in sight.

In essence, we are rewriting the carrying requirements rule with a different one of our own devising, and swapping it in only at those moments when it is correct to do so.

paste.png "Slogar's Revenge"

Section 1 - Procedure

The amulet carrying rule substitutes for the carrying requirements rule when locking something with the Amulet of Tumblers.

The amulet carrying rule substitutes for the carrying requirements rule when unlocking something with the Amulet of Tumblers.

We can now replace the usual behavior of the carrying requirements rule (to check whether the player is carrying something and, if not, to generate an implicit take) with a similar rule of our own; note that "if the player has the second noun" is a more compact way to write "if the player carries the second noun or the player wears the second noun":

This is the amulet carrying rule:
    if the player has the second noun:
        continue the action;
    say "(first picking up the amulet)[command clarification break]";
    try silently taking the second noun;
    if the player is not carrying the second noun:
        stop the action;

Section 2 - Scenario

The Daunting Dungeon is a room.

West of the Daunting Dungeon is the Disturbing Door. The Disturbing Door is a door. West of the Disturbing Door is the Fallow Field.

The Disturbing Door is closed and locked.

The player wears the Amulet of Tumblers. The Amulet of Tumblers unlocks the Disturbing Door.

Test me with "unlock disturbing door with amulet / open door / west / remove amulet / close door / lock disturbing door with amulet / drop amulet / unlock disturbing door with amulet".

For a more systematic handling of the keychain problem (and a number of other refinements to the behavior of doors), see the Locksmith extension included with Inform.

***ExampleSlogar's Revenge
Creating an amulet of tumblers that can be used to lock and unlock things even when it is worn, overriding the usual requirement that keys be carried.

Under most circumstances, locking and unlocking require the player to be carrying the key he uses to unlock something. This makes sense -- unless the key is on a keychain, or on a chain around his neck, for instance. So here we explore one way to circumstantially override the carrying requirements, while still making sure that the player cannot unlock the door if the unlocking tool is nowhere in sight.

In essence, we are rewriting the carrying requirements rule with a different one of our own devising, and swapping it in only at those moments when it is correct to do so.

paste.png "Slogar's Revenge"

Section 1 - Procedure

The amulet carrying rule substitutes for the carrying requirements rule when locking something with the Amulet of Tumblers.

The amulet carrying rule substitutes for the carrying requirements rule when unlocking something with the Amulet of Tumblers.

We can now replace the usual behavior of the carrying requirements rule (to check whether the player is carrying something and, if not, to generate an implicit take) with a similar rule of our own; note that "if the player has the second noun" is a more compact way to write "if the player carries the second noun or the player wears the second noun":

This is the amulet carrying rule:
    if the player has the second noun:
        continue the action;
    say "(first picking up the amulet)[command clarification break]";
    try silently taking the second noun;
    if the player is not carrying the second noun:
        stop the action;

Section 2 - Scenario

The Daunting Dungeon is a room.

West of the Daunting Dungeon is the Disturbing Door. The Disturbing Door is a door. West of the Disturbing Door is the Fallow Field.

The Disturbing Door is closed and locked.

The player wears the Amulet of Tumblers. The Amulet of Tumblers unlocks the Disturbing Door.

Test me with "unlock disturbing door with amulet / open door / west / remove amulet / close door / lock disturbing door with amulet / drop amulet / unlock disturbing door with amulet".

For a more systematic handling of the keychain problem (and a number of other refinements to the behavior of doors), see the Locksmith extension included with Inform.

Under most circumstances, locking and unlocking require the player to be carrying the key he uses to unlock something. This makes sense -- unless the key is on a keychain, or on a chain around his neck, for instance. So here we explore one way to circumstantially override the carrying requirements, while still making sure that the player cannot unlock the door if the unlocking tool is nowhere in sight.

In essence, we are rewriting the carrying requirements rule with a different one of our own devising, and swapping it in only at those moments when it is correct to do so.

paste.png "Slogar's Revenge"

Section 1 - Procedure

The amulet carrying rule substitutes for the carrying requirements rule when locking something with the Amulet of Tumblers.

The amulet carrying rule substitutes for the carrying requirements rule when unlocking something with the Amulet of Tumblers.

We can now replace the usual behavior of the carrying requirements rule (to check whether the player is carrying something and, if not, to generate an implicit take) with a similar rule of our own; note that "if the player has the second noun" is a more compact way to write "if the player carries the second noun or the player wears the second noun":

This is the amulet carrying rule:
    if the player has the second noun:
        continue the action;
    say "(first picking up the amulet)[command clarification break]";
    try silently taking the second noun;
    if the player is not carrying the second noun:
        stop the action;

Section 2 - Scenario

The Daunting Dungeon is a room.

West of the Daunting Dungeon is the Disturbing Door. The Disturbing Door is a door. West of the Disturbing Door is the Fallow Field.

The Disturbing Door is closed and locked.

The player wears the Amulet of Tumblers. The Amulet of Tumblers unlocks the Disturbing Door.

Test me with "unlock disturbing door with amulet / open door / west / remove amulet / close door / lock disturbing door with amulet / drop amulet / unlock disturbing door with amulet".

For a more systematic handling of the keychain problem (and a number of other refinements to the behavior of doors), see the Locksmith extension included with Inform.