Denizen/0.7/Example Scripts/Advanced Scripts: Difference between revisions

From Citizens Wiki

< Denizen‎ | 0.7

No edit summary
No edit summary
Line 1: Line 1:
[[File:Maggie Feather Debug.png|right|Maggie's Script: Buying Feathers debug screen]]
[[File:Maggie Feather Debug.png|right|Maggie's Script: Buying Feathers debug screen]]
<pre>
<code>
# ASSIGNMENTS.YML ----
# ASSIGNMENTS.YML ----


Line 88: Line 88:
         - GIVE GLOWSTONE_DUST QTY:10
         - GIVE GLOWSTONE_DUST QTY:10
         - CHAT "Thanks! Here's your dust."
         - CHAT "Thanks! Here's your dust."
</pre>
</code>


For a good exercise, I'll leave figuring out the flow of this script up to you!
For a good exercise, I'll leave figuring out the flow of this script up to you!

Revision as of 01:00, 28 August 2012

Maggie's Script: Buying Feathers debug screen

  1. ASSIGNMENTS.YML ----

Denizens:

 Maggie:
   Interact Scripts:
   - 0 Magic Shop
   - 10 ^Magic Shop Not Enough Money
   - 20 ^Magic Shop Feathers
   - 20 ^Magic Shop Dust
   
  1. 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:30'
       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:30'
       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:
       - CHAT "Ah, sorry! 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.'  
       

'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."

For a good exercise, I'll leave figuring out the flow of this script up to you!