7.14. Obedient Characters

| Chapter 7: Other Characters |

| 7.14. Obedient Characters

Other characters can perform all the same activities that the player can; this does not always mean that they're willing to obey the player's instructions. By default, characters will refuse to obey commands of the form JULIA, WEST or ANTONY, TAKE THE PINCUSHION. Their objections can be overridden, however, and The Hypnotist of Blois implements a hypnotist who can make characters obedient at will.

In For Demonstration Purposes, the character is only capable of a few actions at the outset, but can be taught new ones if the player performs them first.

Often we want characters' obedience to be more selective. Just as the viewpoint character may be characterized in terms of what he will and will not do, so may others: Generation X demonstrates a character who will do what she's told, but who will comment unfavorably when the player asks for a nonsensical or repeated action, and who may eventually get fed up and leave.

Characters can be given moral objections to certain commands, as well: Virtue defines a few kinds of actions as bad, so that the character commanded will refuse to perform them.

Under Contract, more subtly, has the character object if the player's commands implicitly require any behavior he considers inappropriate: for instance, if the player commands him to put his pants in a container, he will work out that this requires the removal of the pants as a preliminary. If we want to implement a similar character, we may want to simply copy his unsuccessful attempt rule and the table of his retorts, then replace his banter with lines of our choosing.

The little example Latin Lessons allows us to make characters clever about vague commands: we can, for instance, write rules so that CLARK, EAT will have Clark sensibly pick something edible, rather than having the parser ask what we want Clark to eat.

Finally, Northstar demonstrates how we might make Inform understand commands of the form ASK JOSH TO TAKE INVENTORY or ORDER JOAN TO WEAR THE ARMOR.

See Characters Following a Script for a programmable robot who can be given whole sequences of actions to perform

187
| Example The Hypnotist of Blois A hypnotist who can make people obedient and then set them free again. |
WI

239
| Example For Demonstration Purposes A character who learns new actions by watching the player performing them. |
WI

188
| Example Generation X A person who goes along with the player's instructions, but reluctantly, and will get annoyed after too many repetitions of the same kind of unsuccessful command. |
WI

184
| Example Virtue Defining certain kinds of behavior as inappropriate, so that other characters will refuse indignantly to do any such thing. |
WI

205
| Example Under Contract Creating a person who accepts most instructions and reacts correctly when a request leads implicitly to inappropriate behavior. |
WI

357
| Example Latin Lessons Supplying missing nouns and second nouns for other characters besides the player. |
WI

412
| Example Northstar Making Inform understand ASK JOSH TO TAKE INVENTORY as JOSH, TAKE INVENTORY. This requires us to use a regular expression on the player's command, replacing some of the content. |
WI

Most of the time, Inform understands commands to other characters when they take the form "JOSH, TAKE INVENTORY" or "JOAN, WEAR THE ARMOR". But novice players might also try commands of the form ASK JOSH TO TAKE INVENTORY or ORDER JOAN TO WEAR THE ARMOR. The easiest way to make Inform understand such commands is to meddle directly with the player's command, changing it into the format that the game will understand, as here: "Northstar" The Northstar Cafe is a room. "The Northstar is crammed with its usual brunch crowd, and you were lucky to get a table at all. You are now awaiting the arrival of your ricotta pancakes." Josh is a man in The Northstar Cafe. "Josh is on his way past your table." The description of Josh is "He is a waiter here, but you also know him socially, so he tends to be more chatty than the other waiters." A persuasion rule: persuasion succeeds. After reading a command: let N be indexed text; let N be the player's command; replace the regular expression "\b(ask|tell|order) (.+?) to (.+)" in N with "\2, \3"; change the text of the player's command to N. Test me with "ask Josh to take inventory / tell Josh to take inventory / order Josh to take inventory". Note that we have to copy N back explicitly to replace the player's command.

Previous | Contents | Next