2.3. Using the Player's Input

| 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

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

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 indexed text; 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".

Previous | Contents | Next