Paste #775: Shop

Date: 2013/12/31 07:07:55 UTC-08:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


Shoptest:
    type: assignment

    Interact Scripts:
    - Shop

Shop:
    type: interact
    steps:
        1:
            click trigger:
                script:
                - chat "Welcome to my shop <player.name>!"
                - wait 1
                - chat "would you like to buy"
                - chat "Steak for 15 gold"
                - chat "Chicken for 10 gold"
        2:
            Chat trigger:
                1:    
                    trigger: /Steak/
                    script:
                    - check <player.inventory>
                    - if money qty:15 run:GiveSteak
                      else run:NotEnoughMoney
                2:  
                    trigger: /Chicken/
                    script:
                    - if money qty:10 run:GiveChicken
                      else run:NotEnoughMoney               

GiveSteak:
    type: task
    script:
        - take money qt:15
        - give player item: steak
        - narrate "you buy some steak"
        - chat "Thanks for buying come back soon"
        - run script:Shop

GiveChicken:
    type: task
    script:
        - take money qt:10
        - give player item: chicken
        - narrate "you buy some Chicken"
        - chat "Thanks for buying come back soon"
        - run script:Shop   

NotEnoughMoney:
    type: task
    script:    
        - chat "Are you trying to swindle me?"
        - run script:Shop