Paste #29225: Untitled Paste

Date: 2016/01/27 10:14:35 UTC-08:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


3:
            chat trigger:
                'deposit_money':
                    trigger: '/REGEX:(1|deposit|d)/'
                    script:
                    - ^run "deposit_money_task"
                'withdraw_money':
                    trigger: '/REGEX:(2|withdraw|w)/'
                    script:
                    - ^run "withdraw_money_task"

        4:
            chat trigger:
                'deposit_money_amount':
                    trigger: '/REGEX:\A\d*\.?\d*\Z/'
                    script:
                    - ^if '<player.money>' >= <player.chat_history>
                      narrate format:banker_format "<light_purple>There is now <green>β<proc:deposit_procedure><light_purple> in your account"
                      else narrate format:banker_format "<light_purple>You don<&sq>t have <green>β<player.chat_history><light_purple> to deposit!"
                    - trigger name:chat toggle:false
                    - ^run "manage_account_task"


        5:
            chat trigger:
                'withdraw_money_amount':
                    trigger: '/REGEX:\A\d*\.?\d*\Z/'
                    script:
                        - ^if '<player.flag[bankbalance]>' >= <player.chat_history>
                          narrate format:banker_format "<light_purple>You have withdrawn <green>β<player.chat_history><light_purple> from your account; your remaining balance is <green>β<proc:withdraw_procedure>"
                          else narrate format:banker_format "<light_purple>You don<&sq>t have <green>β<player.chat_history><light_purple> to withdraw!"
                        - trigger name:chat toggle:false
                        - ^run "manage_account_task"


deposit_procedure:
    type: procedure
    script:
    - flag player 'bankbalance:+:<player.chat_history>'
    - ^take money qty:<player.chat_history>
    - determine "<flag.p:bankbalance>"


withdraw_procedure:
    type: procedure
    script:
    - flag player 'bankbalance:-:<player.chat_history>'
    - ^give money qty:<player.chat_history>
    - determine "<flag.p:bankbalance>"