Paste #2380: chippy

Date: 2014/03/01 09:22:10 UTC-08:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


Chippy:
  type: assignment 
  actions: 
     on assignment: 
      - trigger name:click state:true
  interact scripts:
  - 50 Chippy Handler 

Chippy Handler:
  type: interact 
  steps: 
    1: 
      click trigger: 
        script: 
        - chat 'Welcome to my chip shop!'
        - wait 1
        - chat 'What would you like?'
        - wait 1
        - chat 'We have Fish, Chips and Fish and chips'
      chat trigger:
         '1':
           trigger: '/Fish/ please'
           script:
           - chat 'Certainly! How many would you like?'
           - chat '5 copper/ea'
           - zap 'step:Fish'
    Fish: 
       chat trigger:
         '1':
           trigger: '/REGEX:./'
           script:
           - define number <player.chat_history[2]>
           - if %number% matches double && %number% > 0 {
             - define total <math:%number%*0.05>
             - if <player.money> > %total% {
               - chat '%total% Total'
               - execute as_server 'money take <player.name> %total%'
               - execute as_server 'give <player.name> cookedfish %number%'
               - chat 'Thank you for your business'
               }
             - if <player.money> < %total% {
               - chat 'You do not have that much sorry!'
             }
           - zap 'step:1'