Conversation Rules

version 7 by Eric Eve

  • Home page
  • Beginning
  • Previous
  • Next



  • Chapter: CONVERSATION NODES

    There may come a point in a conversation when an NPC asks a question or makes a statement to which ASK BOB ABOUT X or TELL BOB ABOUT X would be a clumsy response at best. It may be that a simple yes or no would be better, or it may be that a more elaborate reply is called for. For this type of situation we can use a Conversation Node. Suppose, for example, that Bob asks a question to which the possible answers are YES, NO and I DON'T KNOW. Perhaps the question was "Have you met my cousin Fred?", so we might call our conversation node the bob-fred node:

        The bob-fred node is a Conversation Node.

    Next we need to have some means of letting the player know what responses are possible while we're in this node. For this purpose we can set the Conversation Node's suggestions property:

        The bob-fred node is a Conversation Node. The suggestions is "say yes or no, or say that you don't know"

    The rule here is that the text in the suggestions property is something that can reasonably follow "You could". In the above example the player would see a prompt like "(You could say yes or no, or say that you don't know."). A further refinement is that a Conversation Node can be limited (the default) or unlimited. If the Conversation Node is limited then the suggestions in its suggestions property are the only suggested conversation topics that will be shown. If it is unlimited then all the other topics currently available for suggestion (i.e. all the quizzing and informing topics with a suggest entry greater than 0 in the appropriate table) will be listed too.

    We still need a means for the Conversation Node to respond to the player's special response (in this case yes, no, or don't know). To do this we need to give the Conversation Node a node rule (which in practice will usually be a rulebook):

        The bob-fred-node rules is a rulebook.
        The node rule of the bob-fred node is the bob-fred-node rules.

    Then we need to define the appropriate rules for handling the player's possible responses. We'll start by handling the straightforward YES and NO responses:

        A bob-fred-node rule when saying yes:
    say "'Yes, I ran into him the other day,' you say.

         'In that case you know he's not very well.' Bob replies[convnode null-node].";
    rule suceeds.

        A bob-fred-node-rule when saying no:
         say "'No, I didn't even know you had a cousin called Fred,' you reply.

         'Unless he recovers soon, I probably won't for much longer,' he replies darkly[convnode null-node].";
         rule suceeds.

    These rules will handle YES or NO or BOB, YES or BOB, NO or SAY YES TO BOB or SAY NO TO BOB (since Conversation Framework, included by Conversation Rules) takes care of converting the other forms to YES and NO respectively). Note that we need to end each rule with "rule succeeds" to prevent fall through to the normal conversation processing (unless, of course, we want to allow this). Not also the "[convnode null-node]", which is used to reset the current conversation node to nothing once we are done with it (this will be explained further below).

    Next, we may want a special rule to make Bob insist on an answer if we don't give him one:

        The last bob-fred-node rule:
         say "'I asked you if you'd met my cousin Fred,' Bob reminds you.";
    rule succeeds.

    Here we don't include "[convnode null-node]", since we want the current node to remain active when Bob doesn't get a satisfactory reply. If we were instead happy for Bob's question to be ignored (say by the player asking about something else) we'd instead write:

        The last bob-fred-node rule:
         Change the current convnode to the null-node;

    This resets the current convnode so that the bob-fred-node rule doesn't stay current once the player has ignored the question that triggered it; we also make sure that this rule doesn't succeed so that we can go on to the ordinary handling of the topic asked about.

    This still leaves the question of how we respond to I DON'T KNOW. This is a bit trickier; the first part of the trick is to think of all the ways the player might signal I DON'T KNOW and then wrap them up in an Understand statement:

        Understand "you don't/dont know" or "i don't/dont know" or "don't know" or "dont know" as "[dont know]".

    Next we have to make these responses understood as a special action, but only when this conversation node is active. A special wierdly-named Xspcing action (most unlikely to clash with anything else) is provided for the purpose. In this case we'd use it thus:

        Understand "[dont know]" as Xspcing when the current convnode is the bob-fred node.

    Then we provide a bob-fred-node rule to respond to this input:

        A bob-fred-node rule when Xspcing:
        if the player's response matches "[dont know]" begin;
            say "[dont know fred].";
    rule succeeds;
    end if.

        A bob-fred-node rule when answering and the topic understood matches "[dont know]":
    say "[dont know fred].";
    rule succeeds;

        To say dont know fred:
    say "'I have met someone called Fred, but I don't know whether he's your cousin,' you reply.
         'He's a tall, thin, bald man with a limp,' Bob tells you, 'anyway -- he's also very sick[convnode null-node].'"

    Note that in this case we need the 'when answering' rule to cover the possibility that the player types SAY I DON'T KNOW or the like.

    Finally, we need some way to trigger the conversation node. At root, the way to activate a Conversation Node is to make it the current convnode, e.g.:

        Change the current convnode to the bob-fred node.

    More normally, though, we'd use a "[convnode whatevernode]" tag inside a text string, e.g.:

        Table of Bob Himself
      response  
      "'How are you today, Bob?' you ask.  
      
      'Better than my cousin Fred, at any rate.' he mutters, 'Have you met him?'[quiz Fred to 1][convnode bob-fred node]"  
      "'How are you doing?' you wonder.  
      'Oh I'm doing fine, just fine,' he assures you."  

    Not only does "[convnode whatevernode]" change the current convnode from within a text string, it also causes the topics associated with the node to be suggested so that the player can see what responses are available.