| Chapter 8: Change |

| 8.2. Changing the command prompt

The command prompt is the text printed by Inform to ask the player for another command. Ordinarily this is simply a greater-than-sign, ">", so we tend not to notice it as text at all. Internally, though, it is a variable value called "command prompt", which means we can change it.

For example, this will be a more conversational sort of prompt:

> When play begins: change the command prompt to "What now? ".

Whereas this will be more up-to-the-minute and demanding:

> When play begins: change the command prompt to "[time of day] >".

("Time of day" is another variable value, which is fairly self-explanatory, but will be covered in detail later on.) The prompt can be changed at any point, so can be used to indicate the current situation, or even as a sly way to introduce a sort of conversation between computer and player.

94
| Example Don Pedro's Revenge Combat scenario in which the player's footing and position changes from move to move, and the command prompt also changes to reflect that.

> Suppose our game features a detailed simulated combat between the player character and his opponent. He might have several weapons available, and several types of attack available; and at any given time he might be perched up in the rigging of his ship, standing on the open deck, or boxed in between some barrels. His options will vary depending on his position, and obviously it would detract from the pacing to make the player keep LOOKing in the middle of combat in order to remind himself where he is. Instead, we'll roll this information into the command prompt: "Don Pedro's Revenge" The Deck of the Helene Marie is a room. "The two crews are embattled all around you, but your attention is reserved for your particular enemy: Don Pedro." Table of Random Prompts
> position | prompt
> boxed | "So securely boxed-in that you can really only parry or thrust, you try to "
> boxed | "Trapped between your barrels, you decide to "
> perched | "Able to slice at your attackers but not to advance or retreat, you choose to "
> perched | "Perched up here with the advantage of height (but little mobility), you attempt to "
> free | "Out on the open deck with no impediments, free to advance or retreat, you decide to "
When play begins: reset the prompt. Every turn: reset the prompt. To reset the prompt: sort the Table of Random Prompts in random order; repeat through the Table of Random Prompts begin; if the position entry is the placement of the player begin; change the command prompt to prompt entry; stop; end if; end repeat. After reading a command: say conditional paragraph break. A placement is a kind of value. The placements are boxed, perched, free. The player has a placement. The player is free. Understand "retreat" or "parry" as retreating. Retreating is an action applying to nothing. Check retreating: if the player is perched, say "You can't move backward or parry very successfully from this position." instead. Carry out retreating: now the player is boxed; say "You protect yourself, but end up wedged in between two barrels." Understand "thrust" or "advance" as advancing. Advancing is an action applying to nothing. Check advancing: if the player is perched, say "You can't move forward from here, only slash." instead. Carry out advancing: now the player is free; say "You push forward aggressively, making your way to the open deck." Instead of jumping: now the player is perched; say "You leap and swing yourself boldly up into the rigging, leaving your attackers beneath you." Instead of jumping when the player is perched: now the player is free; say "You leap down from your position, into the middle of the deck." Test me with "advance / jump / advance / retreat / jump / retreat / retreat / advance". Of course, this won't be much fun until we also provide the player with a few weapons, some more fighting maneuvers, and, most of all, a Don Pedro to defeat.

Previous | Contents | Next