Occasionally, a piece of IF is sufficiently serious that it feels bathetic to offer the player the usual restore-restart-undo-quit options at the end. The following would replace "*** You have died ***" with a centered epitaph, then quit the game when the player hits a key.
This example relies on a standard extension to avoid any fancy programming:
"Battle of Ridgefield"
Include Basic Screen Effects by Emily Short.
Ridgefield is a room.
Instead of doing something when the turn count is greater than 1: say "Alas, you no longer have the strength."; end the story.
Rule for printing the player's obituary:
say paragraph break;
center "In defense of American Independence";
center "at the Battle of Ridgefield, April 27, 1777,";
center "died Eight Patriots who were laid in this ground,";
center "Companioned by Sixteen British Soldiers,";
center "Living, their enemies,";
center "Dying, their guests";
say paragraph break;
wait for any key;
stop game abruptly;
rule succeeds.
By default, Inform reminds the player that he has the option of typing UNDO after a story-ending action. This is generally good practice, especially for the sake of novice players who might not be aware of this possibility otherwise, and might be frustrated by a loss they could easily step back from.
Just occasionally, though, we may decide that the player does not deserve any such notification:
"Finality"
Cliff Edge is a room. "This narrow strip overlooks a gorge many hundreds of feet deep, at whose bottom is a river of molten lava. The walls of the gorge are lined with poison-tipped spikes. Furthermore, the birds that inhabit this valley spit balls of fire. Good thing you're safe up here."
The Table of Final Question Options determines what options are to be given to the player after the story ends. We can change what is mentioned there by altering the entries. (The example Jamaica 1688 explains this table in more detail, and demonstrates some other things that we might do with it.)
When play begins:
choose row with a final response rule of immediately undo rule in the Table of Final Question Options;
blank out the final question wording entry.
Instead of jumping:
say "If you insist.";
end the story.
And if we decided that we didn't want the player to be able to undo the command at all, we should add the use option
Use undo prevention.
Test me with "jump".
The options offered to the player at the end of the game are listed in the Table of Final Question Options, which means that we can add to them simply by continuing the table; what's more, the table gives us the opportunity to create a "final response rule", a rule that the game should follow in order to parse the player's input at this point.
So, for instance, if we wanted the player to be allowed to ask for notes about any of the rooms, characters, or objects in a historical game:
"Jamaica 1688"
Use scoring.
Section 1 - Procedure
Table of Final Question Options (continued)
final question wording
|
only if victorious
|
topic
|
final response rule
|
final response activity
|
"REVEAL the inspiration for something or somewhere"
|
true
|
"reveal [any thing]"
|
investigate something rule
|
--
|
--
|
true
|
"reveal [any room]"
|
investigate something rule
|
--
|
This is the investigate something rule:
repeat through the Table of Footnotey Stuff:
if the player's command matches the topic entry:
say "[revelation entry][paragraph break]";
rule succeeds;
say "I'm afraid I have no revelation to vouchsafe there."
Section 2 - Scenario
The Upper Deck is a room. Lucius is a man in the Upper Deck.
The maximum score is 501.
When play begins: now the score is 501; end the story finally.
Table of Footnotey Stuff
topic
|
revelation
|
"reveal [Lucius]"
|
"Lucius is based on a historical buccaneer who sailed with William Dampier. The original did carry a Greek New Testament, from which he read aloud when the men were stranded in the jungles near Panama."
|
"reveal [Upper Deck]"
|
"The Callisto is a simplified and tidied representation of a pirate sloop ca. 1688."
|