Chapter 2: Adaptive Prose
2.3. Using the Player's Input

We may sometimes want to capture specific words the player has used and then feature that text elsewhere in the game.

Terracottissima Maxima demonstrates using indexed text to describe objects; Mr. Burns' Repast lets the player refer to a fish by any of a number of names, and changes the way the fish is described as a result.

More specialized effects are also possible: Xot shows how to collect the player's erroneous input and store the command line to be printed back later. Igpay Atinlay shows how to parrot the player's command back in pig Latin form.

* See Animals for a dog which the player can re-name

* See Traits Determined By the Player for a way to let the player name the player character


307
*** Example  Terracottissima Maxima
Flowerpots with textual names that might change during play.

WI
411
** Example  Mr. Burns' Repast
Letting the player guess types for an unidentifiable fish.

WI
367
*** Example  Xot
Storing an invalid command to be repeated as text later in the game.

WI

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.

This requires us to borrow the idea of "indexed text" -- a more flexible kind of text than the usual "text that varies" -- from the Advanced Text chapter:

"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."

Last error is indexed 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".

409
* Example  Igpay Atinlay
A pig Latin filter for the player's commands.

WI


PreviousContentsNext