Banker NPC


Author: adamwbb
Created: 2013-10-24T14:01:22-0400
Edited: 2013-10-24T14:04:14-0400
Denizen Version: 0.9.3SNAPSHOT
Views: 20
Downloads: 860
Likes: 0


WGET
Description: This plugin is used with BankCraft plugin.
you may modify script to suit your banking plugin

known bugs:
npc account balance may differ from plugin if you attempted to withdraw more
this is rectified by depositing what you attempted to take out. then do /balance withdraw AMOUNT to make the npc reflect actual bank balance.
check only shows the plugin balance and not what the npc shows as balance

"bankaccount":
  type: assignment
  interact scripts:
  - 10 banker_script
  actions:
        on assignment:
        - trigger name:click toggle:true
        - trigger name:proximity toggle:true
        - trigger name:chat toggle:true
'banker_script':
  type: interact
  steps:
        'announce banker*':
           proximity trigger:
                 Entry:
                   script:
                   - chat "<white>Welcome <aqua><player.name> !"
           click trigger:
                   script:
                   - chat "<white>Do you want to <blue>open <white>an account?"
                   - chat "<blue>Deposit <white>or <blue>withdraw <white>money?"
                   - chat "<blue>Check <white>my account."
                   - if '<flag.p:inbank_money || none>' == none
                         flag player inbank_money:'account balance <player.name>'
           chat trigger:
                 1:
                   trigger: /open/
                   script:
                   - chat "Wait a second..."
                   - ^execute as_player 'bank deposit 0.00'
                 2:
                   trigger: /deposit/
                   script:
                   - chat "How much would you pay in?"
                   - zap step:deposit
                 3:
                   trigger: /withdraw/
                   script:
                   - chat "How much would you withdraw?"
                   - zap step:take
                 4:
                   trigger: /check/
                   script:
                   - ^execute as_player 'bank balance'
        'deposit':
          chat trigger:
                1:
                  trigger: /REGEX:^\d+$/
                  script:
                  - zap 'step:announce banker'
                  - ^if '<player.money.asint>' >= <player.chat_history>
                        chat "There are now <proc:deposit procedure> in your chest."
                        else chat "You do not have enough money to do this!"
        'take':
          chat trigger:
                1:
                  trigger: /REGEX:^\d+$/
                  script:
                  - zap 'step:announce banker'
                  - if '<flag.p:inbank_money>' >= <player.chat_history>
                        chat "It remains <proc:take procedure> in your chest."
                        else chat "You do not have enough money in the bank!"
'deposit procedure':
  type: procedure
  script:
  - flag player 'inbank_money:+:<player.chat_history>'
  - ^execute as_player 'bank deposit <player.chat_history>'
  - determine "<flag.p:inbank_money.asint>"
 
 
'take procedure':
  type: procedure
  script:
  - flag player 'inbank_money:-:<player.chat_history>'
  - ^execute as_player 'bank withdraw <player.chat_history>'
  - determine "<flag.p:inbank_money.asint>"




Comments
2013-10-24 18:41:26 - adamwbb:

edits made: corrected typo in script
2013-11-27 00:52:03 - aufdemrand:

Short and sweet, I like it!