Chapter 8: Vehicles, Animals and Furniture
§8.1. Bicycles, Cars and Boats; §8.2. Ships, Trains and Elevators; §8.3. Animals; §8.4. Furniture; §8.5. Kitchen and Bathroom
|Contents of The Inform Recipe Book|
|Chapter 7: Other Characters|
|Chapter 9: Props: Food, Clothing, Money, Toys, Books, Electronics|
|Indexes of the examples|
§8.1. Bicycles, Cars and Boats
The vehicle kind in Inform refers to an object which can carry at least one person, but is small enough to fit into a single location:
In the Garden is a vehicle called the motor mower.
We can then apply different rules to a player going somewhere on foot or in the vehicle. Peugeot (a bicycle) is an easy example; No Relation (a car) adds an ignition switch to the vehicle; Straw Boater (a motorboat) gets around areas of lake where travel on foot is not just slower but impossible.
Hover (a sci-fi "hover-bubble") changes the appearance of the landscape when it is seen from inside the vehicle.
See Ships, Trains and Elevators for larger conveyances
|Start of Chapter 8: Vehicles, Animals and Furniture|
|Back to Chapter 7: Other Characters: §7.16. Social Groups|
|Onward to §8.2. Ships, Trains and Elevators|
Let's say that our protagonist is about to flee . Obviously, he can't make the journey on foot; he needs transportation.
Include Rideable Vehicles by Graham Nelson.
The Lot is a room. The ten-speed bike is a rideable vehicle in the Lot.
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:
Cambridge is east of the Lot.
And now we borrow from the Actions chapter to prevent travel without the proper equipment:
Instead of going to Cambridge when the player is not on the ten-speed bike:
say "It's a long journey to Cambridge: you'll never make it on foot."
After going to Cambridge:
say "You begin pedalling determinedly.";
continue the action.
Test me with "e / get on ten-speed bike / e".
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:
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..."
Sometimes we like to give properties to kinds of thing, but not fill them in in all cases. For instance, we might have vehicles that optionally make noise, and those might have a "movement sound".
All properties have a default value, which we can find by looking in the Kinds tab of the index. This is what the property will be set to automatically, if we do not change it ourselves. In the case of a text property, that is ""; so for instance we might use our movement sound thus:
Boathouse is a room. "A boathouse circa 1915, which -- though in poor repair -- still suggests Sunday afternoon jaunts taken by women in white gowns and men in straw hats."
North of the Boathouse is the Shallow Water. The description of Shallow Water is "Just south is the boathouse, and beyond it are trees and the marble terrace of the house above. The water deepens to the north."
North of Shallow Water is Deep Water. The description of Deep Water is "From here the boathouse has dwindled invisibly to the south, and you have a broad panorama of the shoreline, all the way down to the Skeleton Point Lighthouse in the southeast."
A vehicle has some text called the movement sound. The sailboat and the motorboat are vehicles in the Boathouse. The movement sound of the motorboat is "VRRRROOOMMMM..." Understand "boat" as the sailboat. Understand "boat" as the motorboat.
Note that we haven't given the sailboat any movement sound at all.
After going somewhere by a vehicle (called cart):
if the movement sound of the cart is not "", say "[the movement sound of the cart][paragraph break]";
continue the action.
Instead of exiting when the player is in a vehicle and the location is not the Boathouse:
say "You're not dressed for a swim."
Instead of going somewhere when the player is not in a vehicle:
say "You'd rather not try to make this journey by swimming alone."
Test me with "n / get in sailboat / n / get out / s / get in motorboat / n / n".
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.
Use full-length room descriptions.
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:
The container interior rule is listed before the room description body text rule in the carry out looking rules.
This is the container interior rule:
if the actor is the player and the player is in an enterable thing (called current cage), carry out the describing the interior activity with the current cage.
Describing the interior of something is an activity.
Now we've done that, we can write a "rule for describing the interior" of something, which will print whatever we like:
Rule for describing the interior of the hover-bubble:
say "The hover-bubble is transparent, but tints everything outside very faintly lavender."
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]."
Definition: a thing is other if it is not the player.
Rule for listing nondescript items of the hover-bubble when the player is in the hover-bubble: do nothing.
Test me with "get in bubble / look / west / take all / look / get out / east".
And now anything that's beside us in the vehicle will be described during that first paragraph, rather than later on.