Inform 7 Home Page / Documentation
§7.6. Getting Started with Conversation
Traditionally, conversation is one of the most difficult things to program in interactive fiction, because of the number of factors affecting the outcome of everything the player does. While it's acceptable for >EXAMINE POT to produce the same response every time the player types it, it's a bit less acceptable for ASK JOE ABOUT HIS ADULTERY to make Joe react the same way every time.
Conversation implementations often need to keep track of a lot of information: what else is going on in the model world, what the character knows, what plot phase we've reached, what mood the character is in, what else we've recently been talking about, whether we've said the same thing before (and how many times); and so on. Later in this chapter we will look at ways to model character knowledge and mood.
Then, too, we have the problem of how the player communicates his conversational intentions to the story. Technology has not yet advanced to the point where a player can simply type in remarks in full natural English and have the character detect the significance, emotional tone, and subtext, if any: so we can't have RACHEL, THIS DESSERT TASTES LIKE FEET or WILL, LOOK! OUR SINISTER METAL FOES ARE APPROACHING! or BOSS, I WOULD BE DELIGHTED TO FILE ANOTHER TPB REPORT.
The challenge is to create an interface that is both easy for the player to use and expressive enough to be interesting. We will look at some of the common solutions in "Saying Complicated Things".
The examples in the following sections point out ways to approach common conversation problems. None of them will offer an adequate system if we want to write a very conversationally rich story, however. This is partly because a thorough conversation system requires quite a lot of code in its own right. It's also partly because there is no one right solution to the problem of conversation design. Different games will have quite different requirements. When making decisions about a new story we have planned, it may be useful to glance through the conversation extensions available for Inform: there are quite a few, offering a range of different interfaces. Even if none is exactly suited for our needs, they may suggest ways to solve particular implementation challenges.
At the other end of the scale, though, there are times when Inform's default implementation is too complicated for what we want to do: so we will start with ways to simplify conversation, before moving to all the exotic complexities.
Before we get into these details, though, we have a couple of examples that are literally about getting started with a conversation: Mimicry introduces the feature that we must greet other characters before beginning to speak to them; The Gorge at George corrects the player's attempts to use a TALK TO command where a different mode of interaction is appropriate instead.
"Gorge at George"
The Dusty Lot is a room. "A few miles up the road from the concert venue, but at least it's cheap to park here."
The motorcyclist is a man in the Dusty Lot. "A man clad in [a list of things worn by the motorcyclist] leans against his Harley and watches you without saying anything." The Harley is scenery in the Lot. The motorcyclist wears a black leather jacket and shades. Understand "man" or "guy" as the motorcyclist.
Understand "talk to [someone]" as a mistake ("To start a conversation, try to ASK [the noun] ABOUT something or TELL [the noun] ABOUT something.").
Instead of asking the motorcyclist about something:
say "He smirks cryptically."
Instead of telling the motorcyclist about something:
say "This does not seem to interest him much."
Test me with "talk to motorcyclist / ask motorcyclist about himself / tell motorcyclist about me".
Suppose we want to add a sense of some conversational flow, so that the player is forced to acknowledge the presence of people before beginning detailed conversations with them. We collect all speech actions into a single category:
"Mimicry"
Asking someone about something is speech. Telling someone about something is speech. Answering someone that something is speech. Asking someone for something is speech.
And then write a general rule.
Before speech in the presence of an ungreeted person: try waving hands.
One complication is that "asking someone to try doing something", which describes commands such as FRED, GO SOUTH, cannot be made into a kind of action. This requires its own rule:
Before asking someone to try doing something in the presence of an ungreeted person: try waving hands.
Now we define what greetings are going to look like:
Check waving hands:
unless the player can see someone who is not the player, say "You are alone." instead.
Carry out waving hands:
say "You nod hello to [the list of ungreeted people who can be seen by the player].";
now every ungreeted person who can be seen by the player is greeted.
The report waving hands rule is not listed in the report waving hands rulebook.
Because of the way we've defined the command, this will now also work if the player waves.
A person can be greeted or ungreeted. A person is usually ungreeted. The player is greeted.
And now the scenario:
The International Convention of Mimes is a room. Lester, Harold, Geoff, Kwame, and Peter are men in the Convention. Elouise is a woman in the Convention. The Invisible Box is an enterable container in the Convention. "You can detect, from the way people keep leaning on it, an invisible box in the middle of the room."
Lester carries a bowler hat.
Instead of speech in the presence of someone:
describe poor reception.
Definition: a person is other if it is not the player.
At 9:01 AM:
move Phineas to the location; say "A mime called Phineas appears from the non-existent bathroom."
Phineas is a man.
A persuasion rule:
describe poor reception;
persuasion fails.
To describe poor reception:
if the player is in the Invisible box,
say "Everyone convulses with silent laughter as you try to shout from within the invisible box.";
otherwise
say "You attempt to convey your meaning with gesture and interpretive dance, but [the list of visible other people] scorn[if the number of visible other people is 1]s[end if] your performance, refusing to respond."
Test me with "ask lester about work / lester, east / ask lester for bowler / lester, nice not talking to you / get in box / ask lester for hat / phineas, east".