Inform 7 Home Page / Documentation
§9.4. When play ends
Short of something like a power cut, the story can only end when one of the two participants chooses to end it: either the player, by deciding that enough is enough, or us.
In story-telling, there are many kinds of ending: happy, sad, decisive, bittersweet, surprise. Inform doesn't try to interfere in that kind of artistic choice, but it does need to know one thing about the ending: is it final, or not? Many authors like to make additional menu items available if the player has completed the story right through, but not if she has reached an early or wrong ending. (See the activity "amusing a victorious player", for example.)
end the story
This phrase ends the story at the next opportunity (typically as soon as the current rule ends), with the closing message "The End." The end is not considered final.
end the story finally
This phrase ends the story at the next opportunity (typically as soon as the current rule ends), with the closing message "The End." The end is considered final, and any hidden menu options will be revealed.
end the story saying (text)
This phrase ends the story at the next opportunity (typically as soon as the current rule ends), with the closing message given in the text. The end is not considered final. Example:
end the story saying "You have been stymied"
end the story finally saying (text)
This phrase ends the story at the next opportunity (typically as soon as the current rule ends), with the closing message given in the text. The end is considered final, and any hidden menu options will be revealed. Example:
end the story finally saying "You have defeated Sauron"
The closing message is traditionally set out in asterisks:
*** The End ***
This style is traditional in IF, and goes back to 1980 if not earlier.
We can test the current state like so:
if story has ended:
This condition is true if an end has been declared using one of the "end the story..." phrases.
if story has not ended:
This condition is true if no end has been declared using one of the "end the story..." phrases.
if story has ended finally:
This condition is true if an end has been declared using one of the "end the story finally..." phrases, so that an ending has been reached which the author feels is a completion of the player's experience.
if story has not ended finally:
This condition is true if an end has been declared using one of the "end the story..." phrases, but not "finally", so the author feels that the player can get further experience by playing again and trying different approaches.
The rulebook "when play ends" is the matching bookend to "when play begins". It is followed when the story decides to end (not when the player simply gives up and quits), and before any epitaph like
*** You have been poisoned ***
appears. For example:
When play ends, say "Oh dear."
Surprisingly, the end is not always the end:
resume the story
This phrase causes an ended story to resume exactly as if no "end the story..." phrase had been used. Example:
When play ends:
if the story has not ended finally:
say "Oh dear. Still, here's another chance.";
resume the story.
The phrase is likely to be sensible only as part of a "when play ends" rule. Other traditional uses include giving the player three lives, as in an old-school arcade machine.
Some older games allowed the player to be resurrected after a death, but punished him by distributing his possessions far and wide. Here we emulate that effect.
"Big Sky Country"
Use scoring.
When play begins: say "There's a bit of a drive over from Anaconda, Montana, and then through a couple or three ghost towns, but finally you find what you're looking for, and strike out on foot..."
Entrance to Devil's Canyon is a room. "You are at the top of a steep road, which proceeds down into the canyon proper." A sign is in Devil's Canyon. It is fixed in place. "An ominous sign has been put up by the local sheriff's office." The description is "PROCEED AT OWN RISK - NO RESCUES!"
Instead of going down when a random chance of 1 in 3 succeeds:
say "Whoooops, your footing is not as secure as you thought...";
end the story.
Dusty Path is below Entrance. "A dusty path, with grey-brown thorny bushes on either side. Immediately to your right is a sheer drop; far below you can see the rusting remains of a Model T that some fool tried to drive by here."
Hairpin is below Dusty Path. "A sharp bend in the road, doubling back down towards the bottom of the canyon. Just north of here there is also a small cavern of some kind[if the stick pin is in the cavern], which attracts your eye with some glittery thing[end if]."
The Cavern is north of Hairpin. "Really not much more than a little hollow in the side of the canyon." In the cavern are a snake and a diamond stick pin. The snake is an animal. The description of the snake is "You're no expert, but it looks like a rattler."
Instead of taking the diamond stick pin in the presence of the snake: say "Turns out the snake is partial to that there pin, and takes exception to your intending to make off with it."; end the story.
In a fuller implementation of this game, we might make it possible to get by the snake, but in this version, it's just going to remain troublesome.
Crooked Path is below Hairpin. "You're about two thirds of the way down to the bottom of the cavern at this point."
At the Spot is below Crooked Path. "This'll be it: a bare patch of ground that might as well have an X painted right on it."
Rule for supplying a missing noun while digging:
now noun is the location.
Understand "dig" or "dig hole/here" or "dig in ground/dirt/earth" as digging. Digging is an action applying to one thing.
Instead of digging at the spot:
say "You dig and dig, and after a half hour or so, sure enough, you do turn up a big box of gold! You're going to be richer than God and Bill Gates put together.";
increase the score by 5;
end the story finally.
Instead of digging at the spot when the player does not carry the shovel:
say "What, without your shovel? That won't work too well."
The player carries a walking stick. The player wears a hat, a whistle, and a daypack. The daypack contains a mylar blanket, a granola bar, a cellular phone, a water bottle, a folding shovel, and a photocopied map. The granola bar is edible. Instead of drinking the water, say "You quench your thirst, for the time being." The description of the map is "The map shows the winding path of Devil's Canyon, with a large X down by the south end. That would be where your uncle Jesse buried the gold from the train robbery."
The maximum score is 5.
When play ends when the story has not ended finally:
say "Oh dear, that ought to be fatal! However, if you like I can get you out of it...
Shall I? >";
if the player consents:
repeat with item running through things had by the player:
move the item to a random visited room;
say "A strong wind picks you up and sets you back at [the location], though perhaps minus a few of your things.";
resume the story;
try looking.
"If the player consents" is just a convenient way to ask a yes/no question that the player must answer before going on with the game.