Denizen/0.7/Example Scripts/Advanced Scripts

From Citizens Wiki

< Denizen‎ | 0.7

Revision as of 03:49, 1 September 2012 by Jrbudda (talk | contribs)

These scripts use all the powerful features of Denizen to do some really cool things.

Maggie's Magic Shop

Maggie's Script: What would you like to buy?
Maggie's Script: Buying Feathers game screen
Maggie's Script: Buying Feathers debug screen
# Maggie sells some magic items for money.
# Version 1.1

# ASSIGNMENTS
#
#  Maggie:
#    Interact Scripts:
#    - 0 Magic Shop
#    - 10 ^Magic Shop Not Enough Money
#    - 20 ^Magic Shop Feathers
#    - 20 ^Magic Shop Dust
    
# MAGGIES MAGIC SHOP.YML ----

'Magic Shop':
  Type: Interact
  Requirements:
    Mode: None
  Steps:
    1:
      Proximity Trigger:
        Script:
        - CHAT 'Welcome to my shop! Have a look around!'
      Click Trigger:
        Script:
        - CHAT 'What would you like to buy?'
        - HINT
      Chat Trigger:
        1:
          Trigger: I would like to buy some /feathers/
          Script:
          - CHAT 'Great! Feathers are 20 coins.'
          - ^NARRATE 'Right click to purchase some feathers.'
          - FLAG 'MAGICSHOPITEM:FEATHER' 'DURATION:15'
        2:
          Trigger: I would like to buy some /glowstone dust/
          Script:
          - CHAT 'Great! Glowstone dust is 50 coins.'
          - ^NARRATE 'Right click to purchase some glowstone dust.'
          - FLAG 'MAGICSHOPITEM:DUST' 'DURATION:15'
        3:
          Trigger: I would like to buy some /*/
          Script:
          - CHAT "Ah! Sorry, I don't sell any of that!"

          
'Magic Shop Not Enough Money':
  Type: Interact
  Requirements:
    Mode: All
    List:
    - FLAGGED 'MAGICSHOPITEM'
  Steps:
    1:
      Click Trigger:
        Script:
        - ^NARRATE "Erm... seems you don't have enough money."
        - RESET 'FLAG:MAGICSHOPITEM'

        
'Magic Shop Feathers':
  Type: Interact
  Requirements:
    Mode: All
    List:
    - FLAGGED 'MAGICSHOPITEM:FEATHER'
    - MONEY 20
  Steps:
    1:
      Click Trigger:
        Script:
        - ^TAKE MONEY QTY:20
        - ^GIVE FEATHER QTY:10
        - CHAT 'Thanks! Here are your feathers.'  
        - NARRATE 'You bought 10 Feathers for 20 coins! Sweet!'
        - NARRATE 'Right click again to buy some more.'

        
'Magic Shop Dust':
  Type: Interact
  Requirements:
    Mode: All
    List:
    - FLAGGED 'MAGICSHOPITEM:DUST'
    - MONEY 50
  Steps:
    1:
      Click Trigger:
        Script:
        - ^TAKE MONEY QTY:50
        - ^GIVE GLOWSTONE_DUST QTY:10
        - CHAT "Thanks! Here's your dust."
        - NARRATE 'You bought 10 Glowstone Dust for 50 coins! Sweet!'
        - NARRATE 'Right click again to buy some more.'


The Race

---- assignments.yml----
Denizens:
  Coach:
    Interact Scripts:
      - 0 Coaches Race
    

---- Scripts.yml -----

'RaceEnd': 
  Type: Task    
  Script:       
  - NARRATE "%%cTimes Up!"
  - ZAP 'SCRIPT:Coaches Race' 3
  
"Coaches Race":
  Type: Interact   
  Requirements:
    Mode: All
    List:
     - -FINISHED Coaches Race
  Steps:
    1:
      Click Trigger:
        Script:
          - CHAT "Think you're fast, sonny-jim?"
          - CHAT "Lets see how fast you are. Run up that hill, around the tree, and back in 15 seconds, if you can!"
          - WAIT 1
          - CHAT "On your mark, get set, go!"
          - RUNTASK SCRIPT:RaceEnd DELAY:15
          - ZAP 2
    2:
      Location Trigger:
         1:
           Trigger: theTree
           Script: 
            - ZAP 4
      Click Trigger:
        Script:
          - CANCELTASK RaceEnd
          - CHAT "Trying to cheat eh?, you have to go around the tree!, try again later, slowpoke!"
          - ZAP 1
    3:
      Click Trigger:
        Script:
          - CHAT "Aww too slow!, go run some laps and try again!"
          - ZAP 1
    4:
      Click Trigger:
        Script:
          - CANCELTASK RaceEnd
          - CHAT "Woo, you are quick! Good job!"
          - GIVE MONEY QTY:1000
          - FINISH


To Do