Chat Tree Template


Author: Verva
Created: 2012-10-06T16:16:53-0400
Edited: 2012-10-06T16:22:02-0400
Denizen Version: 0.76
Views: 102
Downloads: 1161
Likes: 2


WGET
Description: DB error corrupted this description field. Sorry :(

~Management

#~~~~~~~~   assignments.yml  ~~~~~~~~~
Denizens:
  Sal:
    Interact Scripts:
      - 1 Hello Sal
      - 3 SAL-1-1
      - 3 SAL-2-1
      - 3 SAL-2-BACK
      - 3 SAL-2-2-NODAVE
      - 3 SAL-2-2-YESDAVE
 
   #The flags remove the necessity of prioritizing.
 
#~~~~~~~~~~ Sal Scripts.yml  ~~~~~~~~~~~

'Hello Sal':
  Type: Interact
  Requirements:
    Mode: NONE
    List: 
  Steps:
    1:
      Click Trigger:
        Script:
        - CHAT "My name is Sal. Can I help you?"
        - ^NARRATE "Options:" 
        - ^NARRATE "1: Yes"      # I use NARRATE over HINT because it gives me greater
        - ^NARRATE "2: No"       #   control over formatting, colors, and options.
      Chat Trigger:
        1:
          Trigger: /Yes/
          Script:
          - CHAT "Oh dandy! I can tell you about <option1> <option2> and <option3>."
          - ^NARRATE "Options:"
          - ^NARRATE "1: Option 1"      # In this case, NARRATE is used because there is no way to sneak HINT in before
          - ^NARRATE "1: Option 2"      # the next script's Chat Trigger.
          - ^NARRATE "1: Option 3"
          - ^NARRATE "1: Leave"  #I always throw this option in there. to remove residual flags and quicky reset the denizen.
          - FLAG 'SAL-1-1' DURATION:20   # This flag enables the next chat option, and if the player leaves will remove the flag, resetting the denizen.
        2:
          Trigger: /no/
          Script:
          - CHAT "Ok then."
 
 
#--------------------------------------------------  SAL-1-1  I use this dealio to make it easyer to find scripts quickly.
 

'SAL-1-1': # Same name as flag to avoid confusing myself.
  Type: Interact
  Requirements:
    Mode: ALL
    List:
    - FLAGGED 'SAL-1-1'
  Steps:
    1:
      Chat Trigger:
        1:    #In this option Sal will ask if you'd like more info, giving you 2 more options. This demonstrates branching the chat tree.
          Trigger: /Option 1/.
          Script:
          - CHAT "Information about Option 1."
          - WAIT 2
          - CHAT "There's 2 more things you can ask about this topic. Pick one."
          - ^NARRATE "Options:"
          - ^NARRATE "1: Option 1."
          - ^NARRATE "2: Option 2."  
          - ^NARRATE "3: Leave."
          - ^RESET FLAG:SAL-1-1        
          - ^FLAG 'SAL-2-1'    # Second question teir, first option. 
        2:    #This option will send you to another chat branch that requires you to have some other requirements. 
          Trigger: /Option 2/.
          Script:
          - CHAT "Response to Option 2."
          - WAIT 2
          - CHAT "Have you met dave? I can tell you where a thing is if you have.
          - ^NARRATE "Options:"
          - ^NARRATE "1: Yes I have"        #If you haven't met dave and gotten the proper flag from him, picking yes will be lying.
          - ^NARRATE "2: No I haven't"      # as such we'll need a script for such a situation. See below for how that's handled.
          - ^NARRATE "3: Leave"
          - ^RESET FLAG:SAL-1-1
          - ^FLAG 'SAL-2-2'
        3:   #This option gives a requirement for a quest. I could make it more dynamic so if you've taken this option, you can't again, but I'm lazy so deal with it.
          Trigger: /Option 3/.
          Script:
          - CHAT "Information needed to learn about a quest somewhere else."
          - RESET FLAG:SAL-1-1
          - FLAG 'OtherQuestStart'
        4:   #This was the Leave option. This ends the conversation and resets all necessary flags so chatting again will not bug.
          Trigger: /Leave/.
          Script:
          - RESET FLAG:SAL-1-1
          - ^NARRATE "You stop talking to Sal and walk away."
 
 
#----------------------------------------------------------   SAL-2-1  These are the scripts for answering Option 1 in step one of the above script, branching the chat tree.
 
 
'SAL-2-1':
  Type: Interact
  Requirements:
    Mode: ALL
    List:
    - FLAGGED 'SAL-2-1'
  Steps:
    1:
      Chat Trigger:
        1:
          Trigger: /Option 1/.
          Script:
          - CHAT "Information about the thing you asked about. (Option 1)"
          - WAIT 2
          - CHAT "Would you like to know about anything else?"
          - RESET FLAG:SAL-2-1
          - FLAG 'SAL-2-BACK'   #This script will return one teir back, so you can ask a different question.
        2:
          Trigger: /Option 2/.
          Script:
          - CHAT "Information about the thing you asked about. (Option 2)"
          - WAIT 2
          - CHAT "Would you like to know about anything else?"
          - RESET FLAG:SAL-2-1
          - FLAG 'SAL-2-BACK'    #Often in information-heavy chat trees you'll find that most scripts will be almost the same just with different info.
        3:
          Trigger: /Leave/.
          Script:
          - RESET FLAG:SAL-2-1
          - ^NARRATE "You stop talking to Sal and walk away."
 
'SAL-2-BACK'"
  Type: Interact
  Requirements:
    Mode: ALL
    List:
    - FLAGGED 'SAL-2-1-BACK'
  Steps:
    1:
      Chat Trigger:
        1:
          Trigger: /Yes/
          Script:
          - CHAT "There's 2 more things you can ask about this topic. Pick one."
          - ^NARRATE "Options:"
          - ^NARRATE "1: Option 1."
          - ^NARRATE "2: Option 2."  
          - ^NARRATE "3: Leave."
 
 
#---------------------------------------------------------------------- SAL-2-2  These are the scripts that handle sal's response depending on if you have the flag from talking to dave.
 

'SAL-2-2-NODAVE':      # If dave has NOT been spoken to, this script will handle sal's response.
  Type: Interact
  Requirements:
    Mode: ALL
    List:
    - FLAGGED 'SAL-2-2'
    - -FINISHED 'TalkToDave'
  Steps:
    1:
      Chat Trigger:
        1:
          Trigger: /Yes/ I have.
          Script:
          - CHAT "What is the sewer rat's favorite food?"
          - WAIT 2
          - NARRATE "You are confused by this cryptic response. You decide to answer anyway"
          - WAIT 2
          - CHAT AS_PLAYER "...umm ...Pizza?"
          - WAIT 2
          - CHAT "You little liar. Talk to Dave and we'll talk about this."
          - RESET FLAG:SAL-2-2
        2:
          Trigger: /No/ I haven't.
          Script:
          - CHAT "Oh, well than we have nothing to talk about."
          - RESET FLAG:SAL-2-2
        3:
          Trigger: /Leave/.
          Script:
          - RESET FLAG:SAL-2-2
          - ^NARRATE "You stop talking to Sal and walk away."

'SAL-2-2-YESDAVE':     # If dave HAS been spoken to, this script will handle sal's response.
  Type: Interact
  Requirements:
    Mode: ALL
    List:
    - FLAGGED 'SAL-2-2'
    - FINISHED 'TalkToDave'
  Steps:
    1:
      Chat Trigger:
        1:
          Trigger: /Yes/ I have.
          Script:
          - CHAT "What is the sewer rat's favorite food?"
          - WAIT 2
          - NARRATE "You remember the code phrase Dave told you."
          - CHAT AS_PLAYER "A cheezy baguette."
          - WAIT 2
          - CHAT "Yes, indeed. It's dangerous but here's how you get there. <DIRECTIONSLOL>"
          - RESET FLAG:SAL-2-2
          - FLAG 'TreasureQuestStart'
        2:
          Trigger: /No/ I haven't.
          Script:
          - CHAT "Oh, ok then."
          - RESET FLAG:SAL-2-2
        3:
          Trigger: /Leave/.
          Script:
          - RESET FLAG:SAL-2-2
          - ^NARRATE "You stop talking to Sal and walk away."
 
 
 
 
#That's the end. Hope you've gotten some useful info out of this.   ~Verva




Comments
No one has posted a comment! Post one below: