We need to designate certain rooms as roads. Since the status of being a road will not change during play, we do this with a kind:
"No Relation"
A road is a kind of room. Definition: a room is offroad if it is not a road.
Instead of going by a vehicle (called the auto) to somewhere offroad:
say "You can't drive [the auto] off-road."
Trafalgar Square is a road. "The Square is overlooked by a pillared statue of Admiral Lord Horatio Nelson (no relation), naval hero and convenience to pigeons since 1812."
The National Gallery is north of Trafalgar Square. The Strand is east of Trafalgar Square. The Strand is a road.
The car is a vehicle in Trafalgar Square. The ignition is a device. The ignition is part of the car. Instead of going by the car when the ignition is switched off: say "The ignition is off at the moment." Instead of switching on the car, try switching on the ignition. Instead of switching off the car, try switching off the ignition.
Test me with "get in car / n / e / turn on car / n / e / get out / w / n / s / e / get in car / turn off car / w / turn on ignition / w".
(In the course of the writing of Inform 7, much of Trafalgar Square was pedestrianised, making this example already out of date.)
A further technical note: notice "going by a vehicle" in the above rule, rather than "going by something". A rule such as "Instead of going by something..." will be matched whenever the player tries to go some direction while in an enterable object, whether or not that object is actually capable of movement. This is sometimes useful, but in this case we want the warning to apply only when the player is in a vehicle; if we added Trafalgar Square's statue bases to the scenario, we would not want
You can't drive the pedestal off-road.
So we restrict the rule to "Instead of going by a vehicle..."
By default, when the player pushes something a direction, Inform checks to make sure that the object is pushable between rooms. If not, it blocks the action; if so, it carries out a normal going action with the pushed object taken along.
Also by default, this action produces only a description of the new room that we've traveled into. But suppose we would like to print a short message describing the pushing action first:
"Mattress King"
Monica's Bedroom is a room. The Living Room is south of Monica's Bedroom. Rachel's Bedroom is south of the Living Room.
After going a direction (called way-pushed) with something (called the thing-pushed):
say "You push [the thing-pushed] [way-pushed] to [the location].";
continue the action.
The race car bed is an enterable supporter in Monica's Bedroom. It is pushable between rooms.
Test me with "push bed south".
"One Short Plank"
The East Jungle is a room. The plank bridge is west of the East Jungle and east of the West Jungle. The plank is an open unopenable door. "A precarious plank bridge extends [if the location is West Jungle]east[otherwise]west[end if] across the chasm." The description of the plank is "Extremely fragile and precarious."
Instead of going through the plank when the player is carrying something:
say "You step gingerly across the plank, which bows under your weight. But your meagre possessions are the straw which breaks the camel's back!";
end the story.
After going through the plank:
say "You step gingerly across the plank, grateful that you're not burdened.";
continue the action.
There is a feather in the East Jungle.
But indeed, why stop there?
The gigantic stone ball is a thing in the West Jungle. It is pushable between rooms.
Before going through the plank with something:
say "Surely you jest." instead.
Test me with "w / e / w / push ball e / e / get feather / w".
Suppose we have a series of items that might be stacked on top of one another -- say a heavy television on a rolling cart, and we want the player to be able to move the cart with PUSH TELEVISION EAST just as well as with PUSH CART EAST.
This takes a little redirection, using a setting action variables rule. This is not a kind of rule we've encountered yet, and in fact we won't meet it until the Advanced Actions chapter; it is included here for the convenience of authors who want to modify the effect of pushing without reading that far ahead:
"Provenance Unknown"
Setting action variables for pushing something to:
if the noun is enclosed by a pushable between rooms thing (called the pushed item) which is in the location:
now the noun is the pushed item instead.
This rule says that any time we push an object that is on top of a stack of pushable objects, we should transfer the action to the item at the bottom of the stack.
The rest is merely a test case.
The heavy golden idol is on a roller board. The roller board is on a hovercraft.
The hovercraft, the tea trolley, and the skateboard are pushable between rooms.
The hovercraft is in Zeta Proximan Dig Field.
Zeta Proximan Dig Field is a room. "During the day, the field is massed with sweating native workers, overseers, and officials from central command. Now the spades, trowels, brushes, metal detectors, ground probes, plumb lines, and sighting tripods have been laid aside.
All that remains are the trenches and the fine grey dust that blows slowly across them; the moonlight; and the just-emerging outlines of an ancient and alien wall."
The Hover-Road is west of the Dig Field. "A long road hastily laid down, stretching east to west, from the dig site toward the safety of the city."
When play begins:
say "You have, at last, loaded your illicit cargo without setting off any of the many and sensitive alarms set here; now it remains only to sneak out of the area, under the light of Zeta Proxima's lone green moon."
Test me with "push idol west / look / push roller board east / look".
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.
"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".