stablemaster


Author: calico-kid
Created: 2013-09-16T02:13:21-0400
Edited: 2013-09-26T22:07:31-0400
Denizen Version: 9.2
Views: 24
Downloads: 881
Likes: 0


WGET
Description: buy and sell items and rent stables from the stable master the sell prices vary each hour. the stable prices are charged every minecraft day. for this script you will need to set your anchors and have lockett in order to rent the stables. this script made possible by all those who helped me in the denizen dev channel such as jeebiss mcmonkey and aufdemrand


"stablemaster":
   type: assignment
   interact scripts:
   - 1 stable
   actions: 
     on assignment:
     - trigger name:click state:true 
     - trigger name:chat state:true
     - trigger name:proximity state:true 
'stable':
   type: interact
   steps:
       1:
           proximity trigger:
             entry:
              script:
              - chat "Hello my name is Amy welcome to my stables."
              - if  <player.flag[stabledooropen]> == true {
                - switch state:off location:<npc.anchor[stables]>
                }
             exit:
              script:
              - chat "thank you for stopping in!"
              - if  <player.flag[stabledooropen]> == true {      
                - switch state:on location:<npc.anchor[stables]>      
                }                 
           click trigger:
               script:
               - chat "if you need /help/ with anything just say so."
           chat trigger:    
              'sales':
                trigger: I would like to /sell/ some items.
                script:
                - chat "Great we buy /wheat/ /string/ /slime/ and /leather/"
                - wait 1
                - chat "What would you be interested in selling today?"
              'help':
                trigger: /help/
                script:
                - chat "You can check /prices/, /buy/, and /sell/, items or /rent/ a stable from us"
              'rent':
                trigger: /rent/
                script:
                - if <player.flag[stabledooropen]> == true  {
                  - chat "would you like to check out now?"
                  - wait 1
                  - zap 17
                  }
                  else {
                  - chat "our stables rent for 10 coins per day"
                  - wait 2
                  - chat "would you be interested in renting a stable today?"
                  - wait 1
                  - zap 16
                  }
              'buy':
                trigger: i would like to /buy/ some stuff. 
                script: 
                - zap 2 duration:60
                - chat "we sell /horses/ /hay/ /carrots/ /leads/ and /saddles/"
              'prices':
                trigger: I would like to see your /prices/ please.
                script: 
                - chat "Our horses are 1000 coins"
                - chat "Hay is 25 coins per bale."
                - chat "Carrots are 2 coins each"
                - chat "Leads are 5 coins a piece"
                - chat "saddles are 100 coins a piece"
              'string':
                 trigger: I would like to sell some /string/
                 script:
                 - if <flag.p:npcstringamy> == true {
                   - define price <m:<player.flag[npcstringamy_currentprice]>
                   - narrate '<&a>Currently we are buying string for %price% coins a piece<&f>'
                   - wait 1
                   - chat "Is that price acceptable to you?"
                   - flag player npcstringamy_currentitem:287
                   } 
                   else {
                   - flag player npcstringamy_currentitem:287  
                   - flag player npcstringamy_currentprice:<util.random.int[1].to[2]> duration:3600
                   - flag npcstringamy duration:3600
                   - define price <m:<player.flag[npcstringamy_currentprice]>
                   - narrate '<&a>Currently we are buying string for %price% coins a piece<&f>'
                   - wait 1
                   - chat "Is that price acceptable to you?"
                   }
                 - zap 9   
              'wheat':
                trigger: i would like to sell some /wheat/             
                script:
                - if <flag.p:npcwheatamy> == true {
                  - define price <m:<player.flag[npcwheatamy_currentprice]>
                  - narrate '<&a>Currently we are buying wheat for %price% coins a piece<&f>'
                  - wait 1
                  - chat "Is that price acceptable to you?"
                  - flag player npcwheatamy_currentitem:296
                  } 
                  else {
                  - flag player npcwheatamy_currentitem:296  
                  - flag player npcwheatamy_currentprice:<util.random.int[1].to[3]> duration:3600
                  - flag npcwheatamy duration:3600
                  - define price <m:<player.flag[npcwheatamy_currentprice]>
                  - narrate '<&a>Currently we are buying wheat for %price% coins a piece<&f>'
                  - wait 1
                  - chat "Is that price acceptable to you?"
                  }
                - zap 4                 
              'slime':
                 trigger: I would like to sell some /slime/
                 script:
                 - if <flag.p:npcslimeamy> == true {
                   - define price <m:<player.flag[npcslimeamy_currentprice]>
                   - narrate '<&a>Currently we are buying slime for %price% coins a piece<&f>'
                   - wait 1
                   - chat "Is that price acceptable to you?"
                   - flag player npcslimeamy_currentitem:341
                   } 
                   else {
                   - flag player npcslimeamy_currentitem:341  
                   - flag player npcslimeamy_currentprice:<util.random.int[1].to[5]> duration:3600
                   - flag npcslimeamy duration:3600
                   - define price <m:<player.flag[npcslimeamy_currentprice]>
                   - narrate '<&a>Currently we are buying slime for %price% coins a piece<&f>'
                   - wait 1
                   - chat "Is that price acceptable to you?"
                   }
                 - zap 10
              'leather':
                 trigger: I would like to sell some /leather/
                 script:
                 - if <flag.p:npcleatheramy> == true {
                   - define price <m:<player.flag[npcleatheramy_currentprice]>
                   - narrate '<&a>Currently we are buying leather for %price% coins a piece<&f>'
                   - wait 1
                   - chat "Is that price acceptable to you?"
                   - flag player npcleatheramy_currentitem:334
                   } 
                   else {
                   - flag player npcleatheramy_currentitem:334
                   - flag player npcleatheramy_currentprice:<util.random.int[5].to[15]> duration:3600
                   - flag npcleatheramy duration:3600
                   - define price <m:<player.flag[npcleatheramy_currentprice]>
                   - narrate '<&a>Currently we are buying leather for %price% coins a piece<&f>'
                   - wait 1
                   - chat "Is that price acceptable to you?"
                   }
                 - zap 11                  
       2:
           chat trigger:
             'horse':
                trigger: I would like to buy a /horse/ please
                script:
                - zap 1
                - if <player.money> >= 1000 {
                  - take money qty:1000
                  - narrate '1000 coints have been removed from you'
                  - give 383,100 qty:1 
                  } 
                  else {
                  - chat "i am sorry you dont have enough coins" 
                  }
             'saddle':
                trigger: I would like to buy a /saddle/ please
                script:
                - zap 3 duration:30
                - chat "how many saddles would you like to buy?"
                - flag player npcsaddle_currentprice:100
                - flag player npcsaddle_currentitem:329       
             'carrots':
                trigger: I would like to buy some /carrots/ please
                script:
                - zap 6 duration:30
                - chat "how many carrots would you like to buy?"
                - flag player npccarrots_currentprice:2
                - flag player npccarrots_currentitem:391  
             'hay':
                trigger: I would like to buy some /hay/ please
                script:
                - zap 7 duration:30
                - chat "how much hay would you like to buy?"
                - flag player npchay_currentprice:25
                - flag player npchay_currentitem:170   
             'lead':
                trigger: can i please get a /lead/
                script:
                - zap 8 duration:30
                - chat "how many leads would you like to buy?"
                - flag player npclead_currentprice:5
                - flag player npclead_currentitem:420             
       3:
           chat Trigger:
             'givingitemsaddle':
                trigger: /regex:\d+/
                script:
                - define price <m:<player.flag[npcsaddle_currentprice]>*<context.message>>
                - if <player.money> >= %price% {
                  - take money qty:%price%
                  - give <player.flag[npcsaddle_currentitem]> qty:<context.message>>
                  - narrate '<&a>%price% coins have been removed from you.<&f>'
                  - chat "thank you come again" 
                  } 
                  else {
                  - chat "you dont have enought money for that!"
                  - wait 1 
                  - chat "come back when you have more money"
                  }  
                - wait 1               
                - flag player npcsaddle_currentprice:!
                - flag player npcsaddle_currentitem:!                      
                - zap 1      
       4:  
           chat trigger:       
              'yes':
                 trigger: /yes/
                 script:  
                 - chat "how much wheat would you like to sell?"                 
                 - zap 5
              'no':
                trigger: /no/
                script:
                - chat "Ok please check back another time as our prices vary"
                - wait 1 
                - chat "Thank you for your time"
                - zap 1                  
       5:
           chat trigger:
             'selling item':
                trigger: /regex:\d+/
                script: 
                - define "price" "<m:<player.flag[npcwheatamy_currentprice]>*<context.message>>"
                - if "<player.inventory.contains[<player.flag[npcwheatamy_currentitem]>].qty[<context.message>]>" {
                  - take item:296 qty:<context.message>
                  - give money qty:%price%
                  - narrate '<&a>%price% coins have been given to you<&f>'
                  } 
                  else {
                  - chat "you dont have that much wheat with you."
                  - wait 1
                  - chat "come back when you have more."
                  }                  
                - zap 1                  
       6:
           chat Trigger:
             'givingitemcarrots':
                trigger: /regex:\d+/
                script:
                - define price <m:<player.flag[npccarrots_currentprice]>*<context.message>>
                - if <player.money> >= %price% {
                  - take money qty:%price%
                  - give <player.flag[npccarrots_currentitem]> qty:<context.message>
                  - narrate '<&a>%price% coins have been removed from you.<&f>'
                  - chat "thank you come again"
                  } 
                  else {
                  - chat "you dont have enought money for that!"
                  - wait 1 
                  - chat "come back when you have more money" 
                  }
                - wait 1  
                - flag player npccarrots_currentprice:!
                - flag player npccarrots_currentitem:!  
                - zap 1                
       8:
           chat Trigger:
             'givingitemlead':
                trigger: /regex:\d+/
                script:
                - define price <m:<player.flag[npclead_currentprice]>*<context.message>>
                - if <player.money> >= %price% {
                  - take money qty:%price%
                  - give <player.flag[npclead_currentitem]> qty:<context.message>
                  - narrate '<&a>%price% coins have been removed from you.<&f>' 
                  - chat "thank you come again"
                  } 
                  else {
                  - chat "you dont have enought money for that!"
                  - wait 1 
                  - chat "come back when you have more money"
                  }
                - wait 1
                - flag player npclead_currentprice:!
                - flag player npclead_currentitem:! 
                - zap 1                
       7:
           chat Trigger:
             'givingitemhay':
                trigger: /regex:\d+/
                script:
                 - define price <m:<player.flag[npchay_currentprice]>*<context.message>>
                 - if <player.money> >= %price% {
                  - take money qty:%price%
                  - give <player.flag[npchay_currentitem]> qty:<context.message>
                  - narrate '<&a>%price% coins have been removed from you.<&f>'
                  - chat "thank you come again"
                  } 
                  else {
                  - chat "you dont have enought money for that!"
                  - wait 1 
                  - chat "come back when you have more money"
                  }
                 - wait 1  
                 - flag player npchay_currentprice:!
                 - flag player npchay_currentitem:!     
                 - zap 1
       9: 
           chat trigger:
              'yes':
                 trigger: /yes/
                 script:  
                 - chat "how much string would you like to sell?"                 
                 - zap 13
              'no':
                trigger: /no/
                script:
                - chat "Ok please check back another time as our prices vary"
                - wait 1 
                - chat "Thank you for your time"
                - zap 1                  
       10:         
             chat trigger:
               'yes':
                  trigger: /yes/
                  script:  
                  - chat "how much slime would you like to sell?"                 
                  - zap 14
               'no':
                 trigger: /no/
                 script:
                 - chat "Ok please check back another time as our prices vary"
                 - wait 1 
                 - chat "Thank you for your time"
                 - zap 1                  
       11:         
             chat trigger:
               'yes':
                  trigger: /yes/
                  script:  
                  - chat "how much leather would you like to sell?"                 
                  - zap 15
               'no':
                 trigger: /no/
                 script:
                 - chat "Ok please check back another time as our prices vary"
                 - wait 1 
                 - chat "Thank you for your time"
                 - zap 1     
       13:
           chat trigger:
             'selling item string':
                trigger: /regex:\d+/
                script: 
                - define "price" "<m:<player.flag[npcstringamy_currentprice]>*<context.message>>"
                - if "<player.inventory.contains[<player.flag[npcstringamy_currentitem]>].qty[<context.message>]>" {
                  - take item:287 qty:<context.message>
                  - give money qty:%price%
                  - narrate '<&a>%price% coins have been given to you<&f>'
                  } 
                  else {
                  - chat "you dont have that much string with you."
                  - wait 1
                  - chat "come back when you have more."
                  }                  
                - zap 1                  
       14:
           chat trigger:
             'selling item slime':
                trigger: /regex:\d+/
                script: 
                - define "price" "<m:<player.flag[npcslimeamy_currentprice]>*<context.message>>"
                - if "<player.inventory.contains[<player.flag[npcslimeamy_currentitem]>].qty[<context.message>]>" {
                  - take item:341 qty:<context.message>
                  - give money qty:%price%
                  - narrate '<&a>%price% coins have been given to you<&f>'
                  } 
                  else {
                  - chat "you dont have that much slime with you."
                  - wait 1
                  - chat "come back when you have more."
                  }                  
                - zap 1                  
       15:
           chat trigger:
             'selling item leather':
                trigger: /regex:\d+/
                script: 
                - define "price" "<m:<player.flag[npcleatheramy_currentprice]>*<context.message>>"
                - if "<player.inventory.contains[<player.flag[npcleatheramy_currentitem]>].qty[<context.message>]>" {
                  - take item:334 qty:<context.message>
                  - give money qty:%price%
                  - narrate '<&a>%price% coins have been given to you<&f>'
                  } 
                  else {
                  - chat "you dont have that much leather with you."
                  - wait 1
                  - chat "come back when you have more."
                  }                  
                - zap 1          
       16:  
            chat trigger:          
              'yes':
                trigger: /yes/
                script:
                - chat "Ok let me see what is available"
                - chat "ok let me check and see whats available."
                - take money qty:10 
                - if <npc.flag[stable1]> == null  {
                  - flag server players_to_charge:|:<player>
                  - flag npc stable1:true
                  - flag player stabledooropen:true
                  - flag player stable1:true
                  - sign <npc.anchor[stable1]> wall_sign "[Lock]|<player.name>"
                  - chat "ok stable 1 is available for you."
                  - switch state:off location:<npc.anchor[stables]>
                  - zap 1
                  }
                  else if <npc.flag[stable2]> == null  {
                  - flag server players_to_charge:|:<player>
                  - flag npc stable2:true
                  - flag player stable2:true
                  - flag player stabledooropen:true
                  - sign <npc.anchor[stable2]> wall_sign "[Lock]|<player.name>"
                  - chat "ok stable 2 is available for you."
                  - switch state:off location:<npc.anchor[stables]>
                  - zap 1
                  }
                  else if <npc.flag[stable3]> == null  {
                  - flag server players_to_charge:|:<player>
                  - flag npc stable3:true
                  - flag player stable3:true
                  - flag player stabledooropen:true
                  - sign <npc.anchor[stable3]> wall_sign "[Lock]|<player.name>"
                  - chat "ok stable 3 is available for you."
                  - switch state:off location:<npc.anchor[stables]>
                  - zap 1
                  } 
                  else if <npc.flag[stable4]> == null  {
                  - flag server players_to_charge:|:<player>
                  - flag npc stable4:true
                  - flag player stable4:true
                  - flag player stabledooropen:true
                  - sign <npc.anchor[stable4]> wall_sign "[Lock]|<player.name>"
                  - chat "ok stable 4 is available for you."
                  - switch state:off location:<npc.anchor[stables]>
                  - zap 1
                  } 
                  else if <npc.flag[stable5]> == null  {
                  - flag server players_to_charge:|:<player>
                  - flag npc stable5:true
                  - flag player stable5:true
                  - flag player stabledooropen:true
                  - sign <npc.anchor[stable5]> wall_sign "[Lock]|<player.name>"
                  - chat "ok stable 5 is available for you."
                  - switch state:off location:<npc.anchor[stables]>
                  - zap 1
                  } 
                  else if <npc.flag[stable6]> == null  {
                  - flag server players_to_charge:|:<player>
                  - flag npc stable6:true
                  - flag player stable6:true
                  - flag player stabledooropen:true
                  - sign <npc.anchor[stable6]> wall_sign "[Lock]|<player.name>"
                  - chat "ok stable 6 is available for you."
                  - switch state:off location:<npc.anchor[stables]>
                  - zap 1
                  }
                  else if <npc.flag[stable7]> == null  {
                  - flag server players_to_charge:|:<player>
                  - flag npc stable7:true
                  - flag player stable7:true
                  - flag player stabledooropen:true
                  - sign <npc.anchor[stable7]> wall_sign "[Lock]|<player.name>"
                  - chat "ok stable 7 is available for you."
                  - switch state:off location:<npc.anchor[stables]>
                  - zap 1
                  } 
                  else if <npc.flag[stable8]> == null  {
                  - flag server players_to_charge:|:<player>
                  - flag npc stable8:true
                  - flag player stable8:true
                  - flag player stabledooropen:true
                  - sign <npc.anchor[stable8]> wall_sign "[Lock]|<player.name>"
                  - chat "ok stable 8 is available for you."
                  - switch state:off location:<npc.anchor[stables]>
                  - zap 1
                  } 
                  else {
                  - chat " I am sorry but our stables appear to be full right now"
                  }
                  - zap 1
              'no':
                trigger: /no/
                script:
                - chat "ok then is there anything else i can help you with?"   
                - zap 1                
       17:  
            chat trigger:          
              'yes':
                trigger: /yes/
                script:
                - if <player.flag[stable1]> == true  {
                  - flag server players_to_charge:<server.flag[players_to_charge].aslist.exclude[<player>]>
                  - flag npc stable1:!
                  - flag player stabledooropen:!
                  - flag player stable1:!
                  - sign <npc.anchor[stable1]> wall_sign "[Lock]|[nobody]"
                  - chat "ok you have successfully checked out."
                  - switch state:on location:<npc.anchor[stables]>
                  - zap 1
                  }
                  else if <player.flag[stable2]> == true  {
                  - flag server players_to_charge:<server.flag[players_to_charge].aslist.exclude[<player>]>
                  - flag npc stable2:!
                  - flag player stabledooropen:!
                  - flag player stable2:!
                  - sign <npc.anchor[stable2]> wall_sign "[Lock]|[nobody]"
                  - chat "ok you have successfully checked out."
                  - switch state:on location:<npc.anchor[stables]>
                  - zap 1
                  }
                  else if <player.flag[stable3]> == true  {
                  - flag server players_to_charge:<server.flag[players_to_charge].aslist.exclude[<player>]>
                  - flag npc stable3:!
                  - flag player stabledooropen:!
                  - flag player stable3:!
                  - sign <npc.anchor[stable3]> wall_sign "[Lock]|[nobody]"
                  - switch state:on location:<npc.anchor[stables]>
                  - chat "ok you have successfully checked out."
                  - zap 1
                  } 
                  else if <player.flag[stable4]> == true  {
                  - flag server players_to_charge:<server.flag[players_to_charge].aslist.exclude[<player>]>
                  - flag npc stable4:!
                  - flag player stabledooropen:!
                  - flag player stable4:!
                  - sign <npc.anchor[stable4]> wall_sign "[Lock]|[nobody]"
                  - switch state:on location:<npc.anchor[stables]>
                  - chat "ok you have successfully checked out."
                  - zap 1
                  } 
                  else if <player.flag[stable5]> == true  {
                  - flag server players_to_charge:<server.flag[players_to_charge].aslist.exclude[<player>]>
                  - flag npc stable5:!
                  - flag player stabledooropen:!
                  - flag player stable5:!
                  - sign <npc.anchor[stable5]> wall_sign "[Lock]|[nobody]"
                  - switch state:on location:<npc.anchor[stables]>
                  - chat "ok you have successfully checked out."
                  - zap 1
                  } 
                  else if <player.flag[stable6]> == true  {
                  - flag server players_to_charge:<server.flag[players_to_charge].aslist.exclude[<player>]>
                  - flag npc stable6:!
                  - flag player stabledooropen:!
                  - flag player stable6:!
                  - sign <npc.anchor[stable6]> wall_sign "[Lock]|[nobody]"
                  - switch state:on location:<npc.anchor[stables]>
                  - chat "ok you have successfully checked out."
                  - zap 1
                  }
                  else if <player.flag[stable7]> == true  {
                  - flag server players_to_charge:<server.flag[players_to_charge].aslist.exclude[<player>]>
                  - flag npc stable7:!
                  - flag player stabledooropen:!
                  - flag player stable7:!
                  - sign <npc.anchor[stable7]> wall_sign "[Lock]|[nobody]"
                  - switch state:on location:<npc.anchor[stables]>
                  - chat "ok you have successfully checked out."
                  - zap 1
                  } 
                  else if <player.flag[stable8]> == true  {
                  - flag server players_to_charge:<server.flag[players_to_charge].aslist.exclude[<player>]>
                  - flag npc stable8:!
                  - flag player stabledooropen:!
                  - flag player stable8:!
                  - sign <npc.anchor[stable8]> wall_sign "[Lock]|[nobody]"
                  - switch state:on location:<npc.anchor[stables]>
                  - chat "ok you have successfully checked out."
                  - zap 1
                  }   
              'no':
                trigger: /no/
                script:
                - chat "ok then is there anything else i can help you with?"   
                - zap 1                   

"daily charge script":
  type: world
  events:
    on time 13 in W@adventure map:
    - foreach <server.flag[players_to_charge].aslist> {
      - take money qty:10 player:%value%
      }
 




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