§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


arrow-up.pngStart of Chapter 7: Other Characters
arrow-left.pngBack to §7.13. Traveling Characters
arrow-right.pngOnward to §7.15. Goal-Seeking Characters

*ExampleVirtue
Defining certain kinds of behavior as inappropriate, so that other characters will refuse indignantly to do any such thing.

*ExampleThe Hypnotist of Blois
A hypnotist who can make people obedient and then set them free again.

*ExampleLatin Lessons
Supplying missing nouns and second nouns for other characters besides the player.

**ExampleGeneration 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.

**ExampleNorthstar
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.

***ExampleFor Demonstration Purposes
A character who learns new actions by watching the player performing them.

****ExampleUnder Contract
Creating a person who accepts most instructions and reacts correctly when a request leads implicitly to inappropriate behavior.