Paste #13066: Question

Date: 2015/01/18 12:49:06 UTC-08:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


#Alright, in the interest of learning the best way to do this, I'm going to put together an example script so I can show what I'm confused about.

RedBlueGreen:
    type: assignment
    default constants:
        color: (red|blue|green)
    actions:
        on assignment:
        - trigger name:chat toggle:true
        - trigger name:proximity toggle:true
    interact scripts:
    - RBGStart

RBGStart:
    type: interact
    steps:
        1:
            proximity trigger:
                1:
                    script:
                    #Here I'm laying out a list of choices for the player
                    - chat "<white>Hello <player.name>, which color do you like more? <red>Red<white>, <blue>blue<white>, or <green>green<white>?" 
            chat trigger:
                1: 
                    trigger: /regex: (i?) (red)/
                    script: 
                    - chat "<white>Are you sure you want <red>red<white>?"
                    - zap step: 'confirm red'
        'confirm red':
            chat trigger:
                1:
                    trigger: /regex: (i?) (yes)/
                    script:
                    - chat "<white>Oh, thanks for your input."
                2:
                    trigger: /regex: (i?) (no)/
                    script:
                    - chat "In that case, what is your favorite color?"
                    - zap step: 1
#So my question is, can I create a generic script like 'confirm red' to encompass all of the options so I don't have to copy paste the script three times for each choice? 
#I'm not asking becasue I'm too lazy to copy past three scripts, I want to apply the concept to much larger lists.