§6.9. Going, Pushing Things in Directions

Going is the most complex of actions after looking (or perhaps including looking): the success of every movement depends on the direction the player goes; the room he starts from; the room he intends to reach; whether there are any doors intervening (and, if so, whether these are closed or locked); whether he is traveling by vehicle; and whether he is pushing anything in front of him. When he gets there, the description he sees is itself generated by a looking command.

Pushing something in a direction is really a sort of going. The command >PUSH WHEELBARROW WEST first checks certain qualifying rules: by default, only things defined as pushable between rooms may be pushed, and they may be pushed only in horizontal directions (not UP or DOWN) -- though these rules can be overridden, as we see in Zorb. If the player's pushing attempt passes these criteria, the action is translated automatically into a going action, with all the usual checks about whether that direction leads anywhere, whether a door is in the way, and so on. The converted action afterward can be caught with such rules as

Instead of going to the Alpine Meadow with the wheelbarrow:
    say "You don't want to crush the delicate blooms."

Instead of going north with the handcart:
    say "The headwind is so stiff that you are unable to make much northerly progress at all while encumbered by the handcart."

Since the two actions are internally being handled as one, both are discussed here.

It is very common for players to make a mistake and type the wrong direction command, or even to misunderstand the room description and not recognize all the possible exits. Bumping into Walls helpfully adds a facility so that when the player tries to go in the wrong direction, the story lists the correct possibilities, as in

From here, the viable exits are to the south, the east and the west.

Assuming that travel succeeds, another useful technique is to provide some sense of the journey between locations, especially if they are remote from one another or the player has to do something unusual to get from one to the other. Up and Up adds a short description of travel when we approach a new room, before the room description is printed; Veronica, conversely, adds a comment when the player leaves a region of the map. The Second Oldest Problem intervenes and kills a player who tries to travel from one dark room to another. Mattress King embellishes the description that automatically results from PUSH MATTRESS WEST, adding a line that describes the player pushing the object before describing the new room approached.

We may also want to add a brief comment when we arrive in a new room, after the room description is printed. One trivial way to do this is to append the line to the room's main description, conditionally, like this:

The Hammock Emporium is a room. "This is Cousin Ed's shop, the big dream he left accounting to pursue. You can't help gawking at the Luxury Leather Space Hammock, made of genuine red buffalo skins[if unvisited]. [paragraph break]So this is why Grampa makes all those 'lying down on the job' jokes every Thanksgiving[end if].".

But often we want our first-glance comment to come after some items in the room are described; and for this effect, we would use the "first look rule" defined in Saint Eligius.

If these methods are not enough, the looking action has an action-specific variable called "the room-describing action", which records whether this particular instance of looking comes about because the player typed LOOK or because the player traveled to a new location. We can consult this variable if we want to make looking work differently after going, as for instance here:

Check looking when the room-describing action is the going action:
    say "You are temporarily too blinded to see." instead.

Another category of examples treat how we handle the movement commands themselves. The eight compass directions, with UP and DOWN, IN and OUT, are used as standard in most interactive fiction, but they are not the only possible way of navigating, and strike many newcomers to the genre as counter-intuitive, since when strolling around in real life most of us rarely think about our travel in terms of compass orientation. Misadventure allows the player to GO TO a named room, instead, and calculates the best route to reach the destination; Safari Guide builds on this by letting the player make the whole trip in a single move, automatically opening any doors that stand in his way en route.

In the same spirit of interpreting the player's intentions sensibly, Provenance Unknown modifies the pushing command so that if the player pushes the top object in a stack of objects towards a direction, Inform attempts to move the bottom item instead. This is convenient if, for instance, we have a heavy television on a movable cart and want PUSH TELEVISION WEST to work just as well as PUSH CART WEST.

We also sometimes want to respond sensibly to terse movement commands or ones that rely on some knowledge of where the player has already been. Polarity provides a GO BACK command, allowing the player to retreat in the direction from which he came, while Minimal Movement understands LEAVE, GO, and so on as OUT, in the absence of other information. Owen's Law takes this further, calculating from the best routes on a map how to make OUT mean "move towards the exit of this indoor room", and IN mean "proceed further into the interior". Wonderland assigns altitudes to all rooms and works out the local best meaning of UP and DOWN accordingly.

* See Map for how to create other kinds of new direction

* See Varying What Is Read for further divisions of the standard compass, such as north-northwest

* See Ships, Trains and Elevators for ship-board directions

* See Bicycles, Cars and Boats for common vehicles in which to travel the map


arrow-up.pngStart of Chapter 6: Commands
arrow-left.pngBack to §6.8. Taking, Dropping, Inserting and Putting
arrow-right.pngOnward to §6.10. Entering and Exiting, Sitting and Standing

*ExampleVeronica
An effect that occurs only when the player leaves a region entirely.

*ExampleMattress King
Adding extra phrasing to the action to PUSH something in a direction.

*ExampleThe Second Oldest Problem
Adapting the going action so that something special can happen when going from a dark room to another dark room.

*ExampleMisadventure
A going by name command which does respect movement rules, and accepts names of rooms as commands.

*ExampleMinimal Movement
Supplying a default direction for "go", so that "leave", "go", etc., are always interpreted as "out".

*ExampleSaint Eligius
Adding a first look rule that comments on locations when we visit them for the first time, inserting text after objects are listed but before any "every turn" rules might occur.

6

**ExampleUp and Up
Adding a short message as the player approaches a room, before the room description itself appears.

**ExampleWonderland
Hiking Mount Rainier, with attention to which locations are higher and which lower than the present location.

**ExampleSafari Guide
The same functionality, but making the player continue to move until he reaches his destination or a barrier, handling all openable doors on the way.

***ExamplePolarity
A "go back" command that keeps track of the direction from which the player came, and sends him back.

***ExampleBumping into Walls
Offering the player a list of valid directions if he tries to go in a direction that leads nowhere.

There are two aspects of Inform's handling of pushable objects that are particularly prime for modification. One is that we may want to change the language used to refuse the pushing of unpushable objects.

Second, Inform by default assumes that it is impossible to push objects in up or down directions. This makes lots of sense if the player is trying to push a wheelbarrow up a ladder; it makes less sense if instead we're pushing a ball up a slope.

We solve both problems with some syntax borrowed from the chapter on rulebooks: in the first case, we replace the old rule with a new one with more friendly phrasing; in the second, we remove the rule entirely. More about how to do this is described in the rulebooks chapter; and in general we can find out what rules contribute to any given action by looking at the Actions index. In this case, the action is "pushing it to", which has its own set of prerequisites (called check rules) that make sure the object can safely be pushed, before turning processing over to the going action.

paste.png "Zorb"

Section 1 - Procedure

The new can't push unpushable things rule is listed instead of the can't push unpushable things rule in the check pushing it to rules.

This is the new can't push unpushable things rule:
    if the noun is not pushable between rooms:
        say "[The noun] [are] not amenable to being pushed from place to place." instead.

The can't push vertically rule is not listed in any rulebook.

And now to provide a scenario where the player can push something up and down a hillside. Most of the rest of the example is there for local color and to provide a way to demonstrate these rule adjustments:

Section 2 - Scenario

The Steep Hill is a room. The Crest is above Steep Hill. The Valley is below Steep Hill.

The flat rock is a fixed in place thing in the Steep Hill.

The Zorb is a transparent open enterable container in the Steep Hill. "[if the player props the Zorb]The Zorb rests here, kept from further rolling by your support[otherwise]The Zorb is here[end if].". It is pushable between rooms. The description of the Zorb is "A giant plastic inflatable ball, like a hamster ball for humans[if someone is in the Zorb]. Inside [is-are list of people in the Zorb][end if]."

Lucy is a woman in the Zorb.

Carry out going with the Zorb when the Zorb contains Lucy:
    say "Lucy whoops delightedly as she rides along in the Zorb."

Every turn when the Zorb is not in the Valley and the player does not prop the Zorb:
    let next room be the room down from the location of the Zorb;
    if the player is not in the Zorb and the player can see the Zorb:
        say "The Zorb succumbs to gravity and rolls down toward [the next room].";
    move the Zorb to the next room;
    if the player is in the Zorb:
        say "The Zorb rolls you down the hill!";
        try looking;
    otherwise if the player can see the Zorb:
        say "The Zorb rolls ponderously but inevitably into the vicinity.";

Propping relates one person to one thing. The verb to prop means the propping relation.

Carry out going with the Zorb:
    now the player props the Zorb.

Before doing something when the action requires a touchable noun:
    if the noun is not the Zorb, now the player does not prop the Zorb.

Check waving hands when the player is propping something (called casualty):
    try the player releasing the casualty.

Carry out entering the Zorb:
    now the player does not prop the Zorb.

Understand "let go of [something]" or "let [something] go" or "release [something]" or "free [something]" as releasing. Releasing is an action applying to one thing.

Check releasing:
    if the player carries the noun:
        try dropping the noun instead.

Check releasing:
    if the player does not prop the noun:
        say "You are not supporting [the noun]." instead.

Carry out releasing:
    now the player does not prop the noun.

Report releasing:
    say "You let go of [the noun]."

Test me with "d / push zorb up / look / push zorb up / wave / d / d / push zorb up / release zorb / d / push zorb up / touch rock / push the flat rock south".

***ExampleZorb
Replacing the message the player receives when attempting to push something that isn't pushable, and also to remove the restriction that objects cannot be pushed up or down.

There are two aspects of Inform's handling of pushable objects that are particularly prime for modification. One is that we may want to change the language used to refuse the pushing of unpushable objects.

Second, Inform by default assumes that it is impossible to push objects in up or down directions. This makes lots of sense if the player is trying to push a wheelbarrow up a ladder; it makes less sense if instead we're pushing a ball up a slope.

We solve both problems with some syntax borrowed from the chapter on rulebooks: in the first case, we replace the old rule with a new one with more friendly phrasing; in the second, we remove the rule entirely. More about how to do this is described in the rulebooks chapter; and in general we can find out what rules contribute to any given action by looking at the Actions index. In this case, the action is "pushing it to", which has its own set of prerequisites (called check rules) that make sure the object can safely be pushed, before turning processing over to the going action.

paste.png "Zorb"

Section 1 - Procedure

The new can't push unpushable things rule is listed instead of the can't push unpushable things rule in the check pushing it to rules.

This is the new can't push unpushable things rule:
    if the noun is not pushable between rooms:
        say "[The noun] [are] not amenable to being pushed from place to place." instead.

The can't push vertically rule is not listed in any rulebook.

And now to provide a scenario where the player can push something up and down a hillside. Most of the rest of the example is there for local color and to provide a way to demonstrate these rule adjustments:

Section 2 - Scenario

The Steep Hill is a room. The Crest is above Steep Hill. The Valley is below Steep Hill.

The flat rock is a fixed in place thing in the Steep Hill.

The Zorb is a transparent open enterable container in the Steep Hill. "[if the player props the Zorb]The Zorb rests here, kept from further rolling by your support[otherwise]The Zorb is here[end if].". It is pushable between rooms. The description of the Zorb is "A giant plastic inflatable ball, like a hamster ball for humans[if someone is in the Zorb]. Inside [is-are list of people in the Zorb][end if]."

Lucy is a woman in the Zorb.

Carry out going with the Zorb when the Zorb contains Lucy:
    say "Lucy whoops delightedly as she rides along in the Zorb."

Every turn when the Zorb is not in the Valley and the player does not prop the Zorb:
    let next room be the room down from the location of the Zorb;
    if the player is not in the Zorb and the player can see the Zorb:
        say "The Zorb succumbs to gravity and rolls down toward [the next room].";
    move the Zorb to the next room;
    if the player is in the Zorb:
        say "The Zorb rolls you down the hill!";
        try looking;
    otherwise if the player can see the Zorb:
        say "The Zorb rolls ponderously but inevitably into the vicinity.";

Propping relates one person to one thing. The verb to prop means the propping relation.

Carry out going with the Zorb:
    now the player props the Zorb.

Before doing something when the action requires a touchable noun:
    if the noun is not the Zorb, now the player does not prop the Zorb.

Check waving hands when the player is propping something (called casualty):
    try the player releasing the casualty.

Carry out entering the Zorb:
    now the player does not prop the Zorb.

Understand "let go of [something]" or "let [something] go" or "release [something]" or "free [something]" as releasing. Releasing is an action applying to one thing.

Check releasing:
    if the player carries the noun:
        try dropping the noun instead.

Check releasing:
    if the player does not prop the noun:
        say "You are not supporting [the noun]." instead.

Carry out releasing:
    now the player does not prop the noun.

Report releasing:
    say "You let go of [the noun]."

Test me with "d / push zorb up / look / push zorb up / wave / d / d / push zorb up / release zorb / d / push zorb up / touch rock / push the flat rock south".

***ExampleProvenance Unknown
Allowing something like PUSH TELEVISION EAST to push the cart on which the television rests.

***ExampleOwen's Law
OUT always means "move to an outdoors room, or else to a room with more exits than this one has"; IN always means the opposite.