For the sake of argument, suppose we want to parrot back all the player's commands in pig Latin:
"Igpay Atinlay"
Armfay is a room.
After reading a command:
let N be "[the player's command]";
replace the regular expression "\b(<aeiou>+)(\w*)" in N with "\1\2ay";
replace the regular expression "\b(<bcdfghjklmnpqrstvwxz>+)(\w*)" in N with "\2\1ay";
say "[N][paragraph break]";
reject the player's command.
Test me with "nix on the stupid".
Suppose we have an unhappily mutated fish that the player can refer to by any of a number of species names, or any word followed by -fish. We want to reject these commands, but preserve a memory of what the player last tried to call the thing:
"Mr. Burns' Repast"
Wharf is a room.
There is an unknown fish in the Wharf. The unknown fish has some a text called the supposed name. The description of the unknown fish is "The victim of heavy mutagens, this thing is not really recognizable as any species you know.".
Fish variety is a kind of value. The fish varieties are salmon, albacore, mackerel.
Rule for printing the name of the unknown fish:
if the supposed name of the unknown fish is "", say the printed name of the unknown fish;
otherwise say the supposed name of the unknown fish.
After reading a command:
if the unknown fish is visible and player's command matches the regular expression "\b\w+fish":
let N be "[the player's command]";
replace the regular expression ".*(?=\b\w+fish)" in N with "";
now N is "[N](?)";
now the supposed name of the unknown fish is N;
respond with doubt;
reject the player's command;
otherwise if the unknown fish is visible and the player's command includes "[fish variety]":
now supposed name of the fish is "[fish variety understood](?)";
respond with doubt;
reject the player's command.
To respond with doubt:
say "You're not [italic type]sure[roman type] you're seeing any such thing."
Test me with "get swordfish / look / touch monkfish / look / listen to tunafish / x fish / x salmon / look".
Inform can also understand text properties:
"Terracottissima Maxima"
A flowerpot is a kind of thing. A flowerpot has a text called pattern. Understand the pattern property as describing a flowerpot. The printed name of a flowerpot is usually "[pattern] flowerpot". The printed plural name of a flowerpot is usually "[pattern] flowerpots".
The Herb Garden is a room. In the Herb Garden is a flowerpot with pattern "blue willow". In the Herb Garden is a flowerpot with pattern "striped". In the Herb Garden is a flowerpot with pattern "striped".
Test me with "x blue willow / get striped / look".
This may not seem very much different from having the pattern be a kind of value -- except that texts can, of course, hold almost anything. Further exploration of these possibilities may be found in the chapter on Advanced Text.
In Hitchhiker's Guide to the Galaxy, any erroneous command the player types can return to haunt him later in the game. We could do the same, if we liked, by storing the player's command whenever we print a parser error.
"Xot"
Humiliation Chamber is a room. "A grim, grey-walled room. Cameras watch you from every angle; convex mirrors reflect your actions; and up near the ceiling, where you can't disable it, is a loudspeaker."
The last error is a text that varies. The last error is "xot".
Before printing a parser error:
now the last error is the player's command.
Every turn when a random chance of 1 in 2 succeeds:
say "Over the loudspeaker comes some distorted nonsense. If you listen carefully, it sounds as though some fool is saying '[last error], [last error], [last error]!'"
Test me with "wiggle / z / z / z / z / z / z".