Example Chat Trigger 0.8


Author: Jeebiss
Created: 2013-02-05T18:44:11-0500
Edited: 2013-02-05T20:08:34-0500
Denizen Version: 0.8
Views: 84
Downloads: 997
Likes: 0


WGET
Description: This is an example script to explain how to use a denizen Chat Trigger.

Thanks GnomeEffinWay for making it looks nice ;)

#
# This is the simple assignment script for
# the Example Chat Trigger script. To assign
# this example to an NPC, type:
#
# /npc assign --set Talker
#
'Talker':
    type: Assignment

    actions:
        on assignment:
        - trigger name:chat toggle:true

    interact scripts:
    - 10 Example Chat Trigger
 
#
# This is the interact script for the Talker NPC. 
# It explains the usage of 'chat triggers' in
# a dscript.
#
'Example Chat Trigger':
    type: interact
 
    #
    # It is important to see how steps affect the
    # chat triggers. 
    #
    steps:

         # This is the first step. Your default step is denoted
         # with a * character at the end of the name.
        'first step*':
            # This defines the trigger type. In this example
            # were using the 'chat trigger'
            chat trigger:
                # NPCs can have multiple chat triggers in 1 step. This
                # step uses numbers to diffenciate the triggers. 
                '1':
                    # The trigger node is used to define that the NPC 
                    # listens for. The trigger word is defined within
                    # the /../'s. Anything outside of the slashes will
                    # be displayed in the response.
                    trigger: /Hello/, Mr. Talker!
                    # These commands will be executed when the user 
                    # says 'Hello' to the NPC.
                    script:
                    - chat "Oh, hi there <PLAYER.NAME>"
                    - chat "See how I responded to you saying 'hello' to me?"
 
                # This is the beginning of the second chat trigger
                # within the first step of the script.
                '2':
                    # This defines the trigger word for the second
                    # chat trigger.
                    trigger: Let's /move/ on.
                    # This set of commands will be executed when
                    # the user says 'move' to the NPC. The last
                    # command causes the player to move to the 
                    # second step of the script
                    script:
                    - chat "Okay, now we'll move onto the second step."
                    - chat "Now, the second set of chat triggers will work"
                    - zap 'step:second step'
 
        # This defines the second step. These triggers will not
        # trigger unless the player has moved on to this step.
        # Once they have, triggers in the other step will not
        # trigger.
        'second step':
            chat trigger:
                # In this step, the triggers have words for names
                # as opposed to numbers, either way works.
                'first':
                    trigger: Oh, /wow/, this is fancy!
                    script:
                    - chat "Now that you are on the second step, I listen for this chat triggers."
                    - chat "Also, I no longer listen for the first step chat triggers"

                'second':
                    trigger: Time to go /back/ to the first step.
                    script:
                    - chat "Now we'll go back to the first step, so that those trigger are active"
                    - chat "The second step chat triggers will no longer be listened for."
                    - zap 'step:first step*'
 




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