Inform 7 Home Page / Documentation
§8.10. Removing things from play
Some things will occasionally be in a limbo state called being "off-stage": like actors or props not needed in Act II, but perhaps to be brought back on-stage later, they wait on the sidelines. Anything created with no apparent location will start the story off-stage, as in the case of the lamp here:
Aladdin's Cave is a room. The genie's lamp is a container.
(Such things are easy to see in the World index because they are listed after all of the rooms and their contents, not belonging inside any room.) If we wanted to make this clearer to a human reader, we could add:
The lamp is nowhere.
to emphasise the point. In this context, "nowhere" means "in no room". Moving the lamp onto the stage-set, so to speak, is easy:
now the lamp is in the Cave;
or perhaps:
now the player is carrying the lamp;
and we can whisk it away again like so:
now the lamp is nowhere;
(We can't say "now the lamp is somewhere" because that's too vague about exactly where it is.) In older builds of Inform, the usual thing was to write "remove the lamp from play", but that's now a deprecated phrase: better to use "nowhere" instead.
remove (object) from play
Removes the given object from play, so that it is not present in any room. We are not permitted to remove rooms, or doors, or the player, from play; but we are permitted to remove backdrops, making them disappear from all ro ms in which they are present. Example:
remove the gold coin from play;
We can test whether something is on-stage or off-stage with:
if the gold coin is somewhere, ...
if the gold coin is nowhere, ...
Inform also understands two adjectives for this:
if the gold coin is on-stage, ...
if the gold coin is off-stage, ...
Because these are adjectives, they can be used in a few ways which "nowhere" and "somewhere" can't, such as:
say "Ah, so many absent friends. Who now remembers [list of off-stage people]?"
Note that "on-stage" and "off-stage" apply only to things. Rooms, directions and regions are the stage itself: so it makes no sense to ask the question of whether they are "on-" or "off-". Doors are always on-stage; a backdrop, say "the sky", is always on-stage unless it has been taken off by writing something like "now the sky is nowhere".
Some kinds of game objects -- food, for instance -- can only sensibly be used once, and should then be destroyed. The EAT command already implements this, but suppose we also had a category of drinkable potions:
"Beverage Service"
A potion is a kind of thing. The sparkly blue potion is a potion carried by the player.
Level 3 is a room.
Instead of drinking a potion (called the drink):
now the drink is nowhere;
say "You quaff [the drink]. It goes down beautifully."
Test me with "drink sparkly / i".
|
ExampleSpring Cleaning
A character who sulks over objects that the player has broken (and which are now off-stage).
|
|
Here we have a destruction action that allows the player to break any fragile items. Once destroyed, these things are removed from play, but we can still refer to them: they are now off-stage. This makes it easy for our sulking character to list the ones that have been destroyed:
"Spring Cleaning"
A thing can be tough or fragile. A thing is usually tough.
Instead of attacking something fragile:
say "You smash [the noun] to smithereens!";
now the noun is nowhere.
A knick-knack is a kind of thing which is fragile.
Every turn when a knick-knack is off-stage and Granny Blue can see the player:
say "'Ohh,' whimpers Granny to herself softly. 'How I will miss [the list of off-stage knick-knacks]!'"
The Parlor is a room. Granny Blue is a woman in the Parlor. A china lamb, a porcelain milkmaid, a frolicking Dutch cow, and a crystal unicorn are knick-knacks in the Parlor.
Test me with "break lamb / break milkmaid / break cow / break unicorn".
|
ExampleExtra Supplies
A supply of red pens from which the player can take another pen only if he doesn't already have one somewhere in the game world.
|
|
Suppose we have a supply closet in our game from which the player is allowed to take red pens. To keep modeling simple, we only allow him to have one in play at a time, and we test this by seeing whether the red pen is "off-stage" before moving it to his possession.
This approach might seem no different from having a single red pen sitting in the closet, but it may be preferable, for two reasons. First, it's not very plausible for a supply closet to contain nothing but a single red pen (well, assuming a well-regulated supplier, anyway); and second, it gives the player a way to get a new red pen should the original be destroyed in a tragic handwriting accident.
"Extra Supplies"
The Supply Closet is a room. A supply of red pens is in the Supply Closet. Understand "pen" as the supply of red pens when the red pen is not visible.
There is a red pen.
Instead of taking the supply of red pens:
if the red pen is off-stage:
move the red pen to the player;
say "You help yourself to a fresh red pen.";
otherwise:
say "You're only allowed one pen at a time. The department secretary is very strict."
South of the Supply Closet is the Furnace Room. The incinerator is a thing in the Furnace Room. It is a container. "The incinerator is here, working full blast."
After inserting something into the incinerator:
now the noun is nowhere;
say "A fiery blast consumes [the noun]!"
Test me with "get pen / i / get pen / get supply / s / put pen in incinerator / n / get pen".