Inform 7 Home Page / Documentation
§3.16. Vehicles and pushable things
Next in the tour of standard kinds is the "vehicle". This behaves like (indeed, is) an enterable container, except that it will not be portable unless this is specified.
In the Garage is a vehicle called the red sports car.
The player can enter the sports car and then move around riding inside it, by typing directions exactly as if on foot: and the story will print names of rooms with "(in the red sports car)" appended, lest this be forgotten.
We have already seen that some things are portable, others fixed in place. In fact we can also make a third sort of thing: those which, although not portable, can be pushed from one room to another with commands like "push the wheelbarrow north". At a pinch, we might just be willing to allow:
The red sports car is pushable between rooms.
But of course this is a property which almost any thing can have, not just a vehicle. (Only "almost" because Inform will not allow a door to be pushable between rooms, in the interests of realism rather than surrealism.)
If we need vehicles which the passenger sits on top of, like a horse or a tractor, the standard "vehicle" kind will not be ideal. However, by loading one of the extensions which comes ready-installed:
Include Rideable Vehicles by Graham Nelson.
...we are provided with two more kinds, "rideable vehicle" and "rideable animal", just right for the tractor and the horse respectively. (As with all extensions, the documentation can be seen by clicking Go on some source which contains the above line, and then turning to the Contents index; or from the Installed Extensions tab of the Extensions panel.)
See Going by, going through, going with for further ways to customize vehicle behaviour
|Start of Chapter 3: Things|
|Back to §3.15. Light and darkness|
|Onward to §3.17. Men, women and animals|
Let's say that our protagonist is about to flee . Obviously, he can't make the journey on foot; he needs transportation.
We make the ten-speed bike a rideable vehicle because we want to say that the player is on it rather than in it. Then our other room:
And now we borrow from the Actions chapter to prevent travel without the proper equipment:
Disenchantment Bay 8
We probably do not need a vehicle to ride around our boat, but there might be a heavy ice chest that can only be pushed from room to room:
The ice chest is a closed openable container in the Deck. "A very heavy ice chest sits on the ground." It is fixed in place and pushable between rooms. A quantity of ice is in the chest. The description is "Ready and waiting just in case there's any fish needing to be kept cool."
This anticipates a later chapter, but it would probably be a good idea to hint to the player, if he tries to take the ice chest, that there is another way to move it:
Otherwise, attempts to pick it up will just reply with "That's fixed in place."
Suppose we want the player to see a modified room description when he's viewing the place from inside a vehicle. There are several conceivable ways of doing this; the example here shows a rather advanced way, but is very flexible and will let us write all sorts of special cases.
Emerald City is a room. "All the buildings are spires and none of them have doors." The Vast Desert is west of Emerald City. "[if the player is in a vehicle]Outside, a[otherwise]A[end if] trackless waste stretches as far as the eye can see in every direction."
The hover-bubble is a vehicle in the Emerald City. "Your hover-bubble awaits." The description is "The hover-bubble is a clear globe-shaped vehicle capable of transporting you anywhere you could walk, but faster." Understand "bubble" as the hover-bubble. The hover-bubble contains a chocolate wrapper and a parking ticket.
Here's the tricky part, which relies on material from the chapters on Activities and Rulebooks:
Now we've done that, we can write a "rule for describing the interior" of something, which will print whatever we like:
In fact, as a special refinement, we could even say:
Rule for describing the interior of the hover-bubble when the hover-bubble contains more than one thing:
say "The hover-bubble is transparent, but tints everything outside very faintly lavender. Beside you you can see [a list of other things in the hover-bubble]."
And now anything that's beside us in the vehicle will be described during that first paragraph, rather than later on.