Sometimes it is useful to direct all -- or almost all -- actions from one object to another. For the sake of argument, say we have a sheet of paper with writing on it, and (because we're very meticulous) we want to let the player examine the writing and get a customized response, different from when he just examines the sheet of paper. But for all other purposes -- say, TAKE or TASTE -- we want the two objects to be treated as one.
Here, we approach the problem by changing the noun and/or the second noun of the current action, then issuing a new command to "try the current action". Because we've changed the noun and second noun, the "current action" at this point is different from the one generated originally by the player's command.
"Fine Laid"
High Street Stationer is a room.
The sheet of paper is a thing in High Street Stationer. The writing is part of the sheet of paper.
The description of the sheet of paper is "A beautiful sheet of heavy cream paper." The description of the writing is "Delicate and spidery."
Instead of tasting the sheet of paper, say "You might need more fiber in your diet, but this isn't the way.".
Before doing something other than examining when the current action involves the writing:
if the writing is the noun, now the noun is the sheet of paper;
if the writing is the second noun, now the second noun is the sheet of paper;
try the current action instead.
Test me with "examine sheet of paper / examine writing / get writing / taste writing".
Occasionally we will want to replace the player's question topic with another of our own devising. We can do this in the simplest possible case like so:
"Lucy"
The International Boardgame Championship is a room. Lucy is a woman in the Championship.
Instead of asking Lucy about "checkers":
try asking Lucy about "games".
Instead of asking Lucy about "games",
say "'I don't like games,' she sniffs."
Test me with "ask lucy about checkers / ask lucy about games".
Note that this syntax did not work in older versions of Inform; it is now safe.
"Cactus Will Outlive Us All"
Death Valley is a room. Luckless Luke and Dead-Eye Pete are men in the Valley. A cactus is in the Valley. Persuasion rule: persuasion succeeds.
A person has an action called death knell. The death knell of Luckless Luke is pulling the cactus. The death knell of Dead-Eye Pete is Luke trying dropping the cactus.
Before an actor doing something:
repeat with the victim running through people in the location:
let the DK be the death knell of the victim;
if the DK is not waiting and the current action is the DK:
say "It looks as if [the DK] was the death knell for [the victim], who looks startled, then nonexistent.";
now the victim is nowhere.
If we leave it at that, then pulling the cactus will kill Luckless Luke but then say "Nothing obvious happens.", which seems like a bit of an anti-climax. So we add a special case response for that one:
After pulling the cactus when Luckless Luke was in the location:
say "That's a real shame."
Test me with "get cactus / drop cactus / luke, get cactus / luke, drop cactus / pull cactus / look".
Suppose (as in Infocom's Leather Goddesses of Phobos) that we have a maze that the player can escape only by performing the correct sequence of actions in the correct order. One way to do this would be to keep a list of the player's most recent actions, and see whether these match up with the combination we have established as the maze's solution.
For instance:
"Leopard-skin"
The Fur-Lined Maze is a room. "This seemingly endless sequence of rooms is decorated in a tasteful selection of exotic furs and gilded fixtures."
Clapping is an action applying to nothing. Understand "clap" as clapping.
Kweepaing is an action applying to nothing. Understand "kweepa" as kweepaing.
Carry out clapping:
say "You clap."
Carry out kweepaing:
say "You holler 'KWEEPA!' triumphantly."
The maze-sequence is a list of stored actions that varies.
When play begins:
add jumping to the maze-sequence;
add clapping to the maze-sequence;
add kweepaing to the maze-sequence.
The attempted-sequence is a list of stored actions that varies.
Every turn when the player is in the Fur-Lined Maze:
truncate the attempted-sequence to the last two entries;
add the current action to the attempted-sequence;
if the attempted-sequence is the maze-sequence:
say "That does it! You are instantly transported from the maze!";
end the story finally.
Test me with "hop / clap / clap / hop / kweepa / hop / clap / kweepa".
There is very little to this, in fact. The tricky rule to enforce is Repetition: the player is forbidden to repeat any previously tried action. We keep track of this by keeping a set of past actions, which for want of a better term is called the "tally". All we need to do is:
if the current action is listed in the tally, challenge for "Repetition of [the current action]!";
otherwise add the current action to the tally.
Note that the tally can never contain duplicates, and that when, at the end of the round, we print it out, we sort it first - this makes a more natural-looking sentence. (Sorting a list of actions uses the natural order for actions: compare the sequence on the Actions page of the Index.) The full text, then, is:
"I Didn't Come All The Way From Great Portland Street"
The Paris Theatre is a room. An instrument is a kind of thing. The violin, the tuba, the xylophone and the triangle are instruments. The violin is inside the case. The tuba, the xylophone, the radish, the case, the bust of Nicholas Parsons, the purple felt hat and the triangle are in the Paris Theatre.
The Round is a scene. The Round begins when play begins. The Round ends when the turn count is 10.
The tally is a list of stored actions that varies.
When the Round begins:
say "'And the subject on the card is... musical instruments. Will you carry out for us something to do with that, please, for ten turns starting - now!'"
When the Round ends:
sort the tally;
say "Phweeep![paragraph break]'So, when the whistle goes ten turns are up, you get a point for acting when the whistle blows, and in that round you entertained us by [the tally], and you also get a bonus point for keeping going until the whistle went.'";
end the story finally.
To challenge for (infraction - text):
say "Bzzzzt! 'And [one of]Clement Freud[or]Derek Nimmo[or]Kenneth Williams[or]Peter Jones[at random] has challenged.'[paragraph break]'[infraction]'[paragraph break]'Well, as it's your first time playing the game, and the audience was enjoying your contribution so much, I will disallow the challenge, you have [10 minus the turn count] turn[s] left on musical instruments, starting... now!"
Before doing something:
if the current action is listed in the tally, challenge for "Repetition of [the current action]!" instead;
otherwise add the current action to the tally;
if waiting, challenge for "Hesitation!" instead;
if not looking and not waiting and the noun is not an instrument and the second noun is not an instrument, challenge for "Deviation!" instead.
Test me with "look / wait / examine bust / take tuba / get triangle / hit xylophone / get tuba / examine tuba / get violin".
(The Paris Theatre in Lower Regent Street, London, was for many years the home of BBC radio panel games.)
"Anteaters"
A book is a kind of thing. Understand "book" as a book. A book has a table name called the contents.
Report consulting a book about:
say "You flip through [the noun], but find no reference to [the topic understood]." instead.
Instead of consulting a book about a topic listed in the contents of the noun:
say "[reply entry][paragraph break]".
The Guide to Desert Fauna is a book. The contents of the Guide is the Table of Critters.
Table of Critters
topic
|
reply
|
"spines"
|
"You flip through the Guide for a while and eventually realise that spines are flora, not fauna."
|
"anteater colonies"
|
"The giant anteater, which grows to six feet in size and can kill a jaguar, is a solitary animal, found in many habitats, including grasslands, deciduous forests and rainforests. It does not form colonies. That's ants. They're actually quite easy to tell apart."
|
Death Valley is a room. The Guide is in the Valley.
The gizmo is in Death Valley. The gizmo has an action called idea. The description of the gizmo is "The gizmo is hard to describe, but it projects an idea of [idea]."
Before when the player carries the gizmo and the idea of the gizmo is waiting:
say "[The gizmo] eagerly soaks up the whole idea of [the current action].";
now the idea of the gizmo is the current action.
After dropping the gizmo:
say "The percussion of the fall seems to have shaken the gizmo's idea loose! There's nothing for it now but [idea of the gizmo].";
try the idea of the gizmo;
now the idea of the gizmo is waiting.
Test me with "get guide / look up spines in guide / x gizmo / get gizmo / i / x gizmo / drop gizmo / get gizmo / look up anteater colonies in guide / x gizmo / drop gizmo".