Conversation Rules
version 7 by Eric Eve
Documentation
- Chapter: THE BASICS
- Chapter: DEFAULT RESPONSES
- Chapter: CONTROLLING RESPONSE ACCESSIBILITY
- Chapter: COMBINING ASK AND TELL
- Chapter: CONVERSATION NODES
- Chapter: SAYING YES AND NO
- Chapter: SUGGESTED TOPICS
- Chapter: DISAMBIGUATION AND PRIMARY SUBJECTS
- Example: ** The Tribune's Report - A Sample Conversation
Chapter: THE BASICS
Conversation Rules builds on Conversation Framework, List Control and Epistemology (which it uses, and which therefore must be present for it to use) to provide a sophisticated (and fairly complex) means of handling conversations of the ASK/TELL type. It can also suggest to the player which topics are available to be asked about and told about. Finally, it allows the use of Conversation Nodes -- points in a conversation when the player can types responses outside the normal ask/tell paradigm in reply to a question or comment by the NPC. (If this all sounds a bit like the TADS 3 conversation system, there is a reason for that; I originally developed this extension in the course of porting part of a TADS 3 game to Inform 7).
The first point to bear in mind about Conversation Rules is that it supports asking and telling NPCs about things rather than topics; that is it uses the quizzing it about and informing it about actions defined in Conversation Framework (the documentation of which should also be consulted at this point if it is not already familiar), rather than the standard asking it about and telling it about actions that come with Inform 7. That doesn't mean that we can't use asking it about (a topic) and telling it about (a topic) with Conversation Rules; it's just that Conversation Rules provides no additional support for these actions. Instead, it provides support for quizzing and informing NPCs about things (which may include things or subjects -- for which see the Epistemology documentation -- used to represent abstract ideas like love, liberty or the rate of inflation).
Within Conversation Rules each NPC's responses to being quizzed about or informed about something is controlled through a pair of tables we need to define for the purpose: the NPC's quizzing table and informing table. Thus we might define:
Bob is a man. The quizzing table is The Table of Bob's Quizzes. The informing table is The Table of Bob's Informs.
We then need to supply these tables, which take the form:
Table of Bob's Quizzes
| subject | response rule | response table | suggest | |
| bob | bob himself rule | -- | 1 |
This will cause the bob himself rule to be invoked in response to the command ASK BOB ABOUT BOB or ASK BOB ABOUT HIMSELF. It will also cause 'you could ask Bob about himself' to be suggested as a possible topic of conversation with Bob, until we had actually asked him about himself for the first time. If we didn't want this to appear as a suggested topic we could put a 0 in the suggest column (or leave it blank). If we wanted it to be suggested more than once, we would put the number of times Bob could be asked about himself before this ceased to be suggested in the suggest column.
Obviously, we also need to provide an appropriate bob himself rule, for example:
This is the bob himself rule:
say "'How are you today, Bob?' you enquire.
'Fine, just fine,' he replies."
If Bob's responses varied according to circumstances, we could write a more complex rule, or else use a rulebook to decide Bob's response:
Table of Bob's Quizzes
| subject | response rule | response table | suggest | |
| Fred | bob fred rules | -- | 3 |
The bob fred rules is a rulebook.
A bob fred rule when fred is unseen:
say "Who is Fred anyway?' you ask.
'He's my cousin,' Bob tells you."
A bob fred rule when fred is seen:
say "'Fred looks quite ill, don't you think?' you remark.
'Yes - he contracted Dutch Elm Disease last week,' Bob tells you."
A common situation is where we want an NPC to run through a list of responses, supplying a new one each time he is asked until the last is reached, or maybe supplying a random one drawn from a list of possible responses on each occasion. The extension List Control, which Conversation Rules uses, provides a mechanism for running through such a list, while Conversation Rule provides a means of getting the next response from such a list automatically, instead of of explicitly having to write a rule to do it. Just put the name of the table containing the list of responses in the appropriate response table column, e.g.:
Table of Bob's Quizzes
| subject | response rule | response table | suggest | |
| bob | -- | Table of Bob Himself | 3 |
Table of Bob Himself
| response | |
| "'How are you today?' you ask. | |
| 'Fine, just fine,' he assures you." | |
| "'Are you sure you're all right, Bob?' you enquire, 'you look a bit off colour.' | |
| 'I'm absolutely fine,' he insists." | |
| "Are you absolutely sure you're all right?' you ask. | |
| 'How many times do I have to tell you?' he snaps, 'I'm completely all right!'" |
Table of Table Types (continued)
| tabname | index | tabtype | |
| Table of Bob Himself | 0 | stop-list | |
| See the List Control documentation for an explanation of how the above two tables work. It is, by the way, perfectly legal to include both a rule and table name in the same row, in which case the rule will be executed before the next response from the table is shown. This may be useful if, say, we want quizzing someone about something to have a side effect in addition to the display of a conversational exchange. | |||