Macromod, Updated balance display macro

Discussion in 'Basic Tutorials' started by GungnirIncarnate, May 28, 2013.

  1. GungnirIncarnate

    Builder ⛰️ Ex-President ⚒️⚒️ Premium Upgrade

    Joined:
    Jul 18, 2012
    Messages:
    3,229
    Trophy Points:
    47,340
    Gender:
    Male
    Ratings:
    +481
    NOTE: I had to remove the script that updates your balance on joining the game due to changes that were made to the server and caused this to no longer work. So it will be your responsibility to check your balance on logging in to update the macro label.

    Ok so first off you will need to find out what your macro active key is, To do this hit your escape key and go to "options" then "controls, You may have to hit the ">>" button to see it but you want to find your macro activate key, mine is grave which is the "~" button under then escape key which is the default key. (As shown below)
    [​IMG]



    Now that you know your macro activate key you want to return ingame and hold crouch and click your macro activate key, For me and also by default it is (Shift + ~). You should have a screen with your keyboard display and then you will want to click the GUI editor button in the bottom right corner. (also shown in the screenshot below).
    [​IMG]



    Once you have done that you will have the screen like the one below be display, here you will want to either double click or click the little pencil on the ingame tab in the left pane on the screen. (Shown below)
    [​IMG]


    In the next screen we want to create a button so in the lower left corner click the "Button panel commands" button and click "AddLabel". (As shown below)
    [​IMG]



    Now you will need to choose where on the screen you want you balance to be displayed, personally I prefer the top right hand corner. Do not worry too much about where you put it you can simply move it later without having to do this all over again. Once you have chosen a spot for you balance to be displayed and you have placed the label a properties window will appear, in this window you will need to set the control name to "balance", you can also chance the other properties of the label here such as color. I personally prefer to change the Text align option to "middle centre" and the background color opacity to zero so I don't have a black box around it. But when changing the control name to "balance" make sure it is the control name you are changing and not the label text. (Once again, Below)
    [​IMG]




    Now that you have created the label we need to add the scripts that are going to put your balance in that label. To do this lets head back to that screen that had your keyboard on it, but this time in the top right hand corner it should say "Macro Bindings: Keys" you want to click the little arrow on the right of that once, this will take you to the "macro Bindings: Events" page, On this page you will need to click the "Text Editor" button in the lower right corner.
    (And once again)
    [​IMG]



    In the page the is displayer you will want to click in the "create a new file" text box and write "balchecker" I also like to keep everything non capitalised incase it is case sensitive in the future (just for easy reference) and then kit the create button. (You know where it is)
    [​IMG]



    Now you should have had a screen like a text document appear, this is where you will need to past the script that will read chat and update your balance in the label accordingly: (This is a fairly long script this time round guys)

    Code:
    $${
    STRIP(&chat,%CHAT%)
    IFMATCHES(%&chat%,^\[EcoDollars\] (.*)\.(.*))
        MATCH(%&chat%,^\[EcoDollars\] \$(.*),{@&balance})
        IFMATCHES(%@&balance%,^([0-9]+)\.([0-9]+))
            MATCH(%@&balance%,^([0-9]+)\.([0-9]+),{#balanceround,#rest})
            SET(&balance,%#balanceround%.%#rest%)
        ENDIF
    ELSE
        IFMATCHES(%&chat%,^\[EcoDollars\] \$(.*))
            MATCH(%&chat%,^\[EcoDollars\] \$(.*),{@&balance})
            IFMATCHES(%@&balance%,^([0-9]+))
            MATCH(%@&balance%,^(.*),{#balanceround})
            SET(&balance,%#balanceround%)
            ENDIF
        ENDIF
    ENDIF
    SETLABEL(balance,Balance: $%&balance%,balance)
    IFMATCHES(%&chat%,\$[0-9]+\.\d\d has been taken from your account\.)
        MATCH(%&chat%,\$([0-9]+)\.([0-9]+),{#dollartaken,#centstaken})
        IF(#centstaken > %#rest%)
            #rest = #rest + 100
            #rest = #rest - #centstaken
            #dollartaken = #dollartaken + 1
            #balanceround = #balanceround - #dollartaken
        ELSE
            #rest = #rest - #centstaken
            #balanceround = #balanceround - #dollartaken
        ENDIF
        SET(&balance,%#balanceround%.%#rest%)
    ENDIF
    
    IFMATCHES(%&chat%,\$[0-9]+ has been taken from your account\.)
        MATCH(%&chat%,\$([0-9]+),{#dollartaken})
        #balanceround = #balanceround - #dollartaken
        SET(&balance,%#balanceround%.%#rest%)
    ENDIF
    IFMATCHES(%&chat%,\$[0-9]+\.\d\d has been added to your account\.)
        MATCH(%&chat%,\$([0-9]+)\.([0-9]+),{#dollaradded,#centsadded})
        #rest = #rest + #centsadded
        IF(#rest > 99)
            #dollaradded = #dollaradded + 1
            #rest = #rest - 100
        ENDIF
        #balanceround = #balanceround + #dollaradded
        SET(&balance,%#balanceround%.%#rest%)
    ENDIF
    IFMATCHES(%&chat%,\$[0-9]+ has been added to your account\.)
        MATCH(%&chat%,\$([0-9]+),{#dollaradded})
        #balanceround = #balanceround + #dollaradded
        SET(&balance,%#balanceround%.%#rest%)
    ENDIF
    IFMATCHES(%&chat%,\$[0-9]+\.\d\d has been sent to (.*)\.)
        MATCH(%&chat%,\$([0-9]+)\.([0-9]+),{#dollartaken,#centstaken})
        IF(#centstaken > %#rest%)
            #rest = #rest + 100
            #rest = #rest - #centstaken
            #dollartaken = #dollartaken + 1
            #balanceround = #balanceround - #dollartaken
        ELSE
            #rest = #rest - #centstaken
            #balanceround = #balanceround - #dollartaken
        ENDIF
        SET(&balance,%#balanceround%.%#rest%)
    ENDIF
    IFMATCHES(%&chat%,\$[0-9]+ has been sent to (.*)\.)
        MATCH(%&chat%,\$([0-9]+),{#dollartaken})
        #balanceround = #balanceround - #dollartaken
        SET(&balance,%#balanceround%.%#rest%)
    ENDIF
    IFMATCHES(%&chat%,\$[0-9]+\.\d\d has been received from (.*)\.)
        MATCH(%&chat%,\$([0-9]+)\.([0-9]+),{#dollaradded,#centsadded})
        #rest = #rest + #centsadded
        IF(#rest > 99)
            #dollaradded = #dollaradded + 1
            #rest = #rest - 100
        ENDIF
        #balanceround = #balanceround + #dollaradded
        SET(&balance,%#balanceround%.%#rest%)
    ENDIF
    IFMATCHES(%&chat%,\$[0-9]+ has been received from (.*)\.)
        MATCH(%&chat%,\$([0-9]+),{#dollaradded})
        #balanceround = #balanceround + #dollaradded
        SET(&balance,%#balanceround%.%#rest%)
    ENDIF
    IFMATCHES(%&chat%,\[LOTTERY\] You got (.*) for \$(.*))
        MATCH(%&chat%,^\[LOTTERY\] You got (.*) for \$((.*)),{&fill,#lotamount})
        #balanceround = #balanceround - #lotamount
        #rest = #rest
        SET(&balance,%#balanceround%.%#rest%)
    ENDIF
    IFMATCHES(%&chat%,^\[LOTTERY\] Congratulations go to %PLAYER% for winning \$(.*) with .*)
        MATCH(%&chat%,\[LOTTERY\] Congratulations go to %PLAYER% for winning \$((.*)) with (.*),{#winamount,&fill})
        #balanceround = #balanceround + #winamount
        SET(&balance,%#balanceround%.%#rest%)
    ENDIF
    IF(#rest < 10)
        SET(&rest,"0%#rest%")
        SET(&balance,%#balanceround%.%&rest%)
    ENDIF
    SETLABEL(balance,Balance: $%&balance%,balance)
    SET(@&bal,$%&balance%)
    }$$
    
    You paste it in the window using Ctrl + V for windows and Command + C for Mac. Once you have pasted it into that window you want to hit save in the lower right hand corner. (one more time and yes this is a screen from the old balance display macro)
    [​IMG]



    Now you want to go back to your "Macro Bindings: Events" page and click on the "onChat" event button. (I lied :p)
    [​IMG]



    And then write the following in the text bar at the bottom:

    Code:
    $$<balchecker.txt>
    Now click save. If you did everything correctly then your label in the corner should now show your balance and will update every time you pay someone, buy from a trade sign, shout or even win the lottery.


    If you have found anything wrong with this please send me a forum pm and I will do what I can to fix it, also if you have any trouble please do not Pm me ingame, send me a forum Pm instead, Do not expect it to be perfect but I have had 2 - people test it and it works so if you do find something wrong please tell me. Also kukelekuuk00 would you mind having a look at the code and point out any improvements I could make, I had to rewrite your original balance macro to made it fit in with what I wanted to do and I want to know if there is like some kind of fatal fault or a way I could make it shorter.
     
    • Like Like x 1
    • Winner Winner x 1
    • Useful Useful x 1
    • List
    #1 GungnirIncarnate, May 28, 2013
    Last edited: Sep 9, 2014
  2. kukelekuuk

    kukelekuuk C͕̹̲̽ͪ͐ͩ̔L̜̦̝͈ͦ̿̾̿ḘA̻̗̤̳̐ͭ̆̿̃̑ͭN̊̓͑̇ͯ
    Builder ⛰️ Ex-EcoLeader ⚜️⚜️⚜️ Premium Upgrade

    Joined:
    May 25, 2011
    Messages:
    10,061
    Trophy Points:
    80,160
    Ratings:
    +6,925
    #doallartaken = #dollartaken + 1
    line 24

    It looks good aside from that.
     
    #2 kukelekuuk, May 28, 2013
    Last edited: May 28, 2013
  3. GungnirIncarnate

    Builder ⛰️ Ex-President ⚒️⚒️ Premium Upgrade

    Joined:
    Jul 18, 2012
    Messages:
    3,229
    Trophy Points:
    47,340
    Gender:
    Male
    Ratings:
    +481
    Thanks kuke and fixed :)
     
  4. RyanJF1

    RyanJF1 Builder
    Builder ⛰️ Ex-President ⚒️⚒️

    Joined:
    Jul 1, 2012
    Messages:
    6,485
    Trophy Points:
    47,990
    Gender:
    Male
    Ratings:
    +951
    It works great. Thanks Jakey!
     
  5. TdoggTL

    TdoggTL Builder
    Builder ⛰️ Ex-President ⚒️⚒️

    Joined:
    Jul 22, 2012
    Messages:
    1,705
    Trophy Points:
    32,340
    Gender:
    Male
    EcoDollars:
    $552
    Ratings:
    +532
    Nice bal . . .1.2 mil.
     
    • Like Like x 1
    • Agree Agree x 1
    • List
  6. SuburbSomeone

    SuburbSomeone Shrubby Tycoon
    Builder ⛰️ Ex-Tycoon ⚜️⚜️⚜️ Premium Upgrade

    Joined:
    Apr 9, 2013
    Messages:
    3,337
    Trophy Points:
    74,090
    Gender:
    Male
    EcoDollars:
    $0
    Ratings:
    +6,479
    *1.6
     
  7. Conorx

    Conorx Its well and truly Big Boy Season
    EcoMaster ⛰️⛰️⛰️⛰️ Ex-EcoLeader ⚜️⚜️⚜️ Premium Upgrade

    Joined:
    Dec 17, 2012
    Messages:
    429
    Trophy Points:
    61,160
    Gender:
    Male
    Ratings:
    +298
    .
     
    #7 Conorx, May 28, 2013
    Last edited: May 28, 2013
  8. GungnirIncarnate

    Builder ⛰️ Ex-President ⚒️⚒️ Premium Upgrade

    Joined:
    Jul 18, 2012
    Messages:
    3,229
    Trophy Points:
    47,340
    Gender:
    Male
    Ratings:
    +481
    Why does everyone just look at my bal -_- and yes its 1.6 now, some of the screens are old
     
  9. cameron7686

    cameron7686 Builder
    Builder ⛰️ Ex-Mayor ⚒️⚒️

    Joined:
    Feb 5, 2013
    Messages:
    145
    Trophy Points:
    25,585
    Gender:
    Male
    Ratings:
    +5
    When I try to relog, I cant rejoin the server.I get some some error messages and now it says im temporary denied to join the server.
     
  10. cameron7686

    cameron7686 Builder
    Builder ⛰️ Ex-Mayor ⚒️⚒️

    Joined:
    Feb 5, 2013
    Messages:
    145
    Trophy Points:
    25,585
    Gender:
    Male
    Ratings:
    +5
    Ok I have fixed the problem. But now it says my bal is $0.00.
     
    #10 cameron7686, May 28, 2013
    Last edited: May 28, 2013
  11. Lee1104

    Lee1104 Builder
    Builder ⛰️ Ex-Tycoon ⚜️⚜️⚜️

    Joined:
    Oct 5, 2012
    Messages:
    1,922
    Trophy Points:
    31,940
    Gender:
    Male
    Ratings:
    +322
    What does this change from the old one?
     
  12. GungnirIncarnate

    Builder ⛰️ Ex-President ⚒️⚒️ Premium Upgrade

    Joined:
    Jul 18, 2012
    Messages:
    3,229
    Trophy Points:
    47,340
    Gender:
    Male
    Ratings:
    +481
    This doesn't loops /bal and updates whenever you make a transaction instantly. :)
     
  13. MyloSilver

    MyloSilver Builder
    Builder ⛰️ Ex-President ⚒️⚒️

    Joined:
    Feb 10, 2013
    Messages:
    222
    Trophy Points:
    26,490
    Gender:
    Male
    Ratings:
    +165
    Good work as always jakey. :)
     
  14. GungnirIncarnate

    Builder ⛰️ Ex-President ⚒️⚒️ Premium Upgrade

    Joined:
    Jul 18, 2012
    Messages:
    3,229
    Trophy Points:
    47,340
    Gender:
    Male
    Ratings:
    +481

    Your more than welcome mylo
     
  15. MattBrpQc

    MattBrpQc EcoMaster
    EcoMaster ⛰️⛰️⛰️⛰️ Ex-EcoLeader ⚜️⚜️⚜️

    Joined:
    Feb 2, 2013
    Messages:
    689
    Trophy Points:
    51,760
    Gender:
    Male
    Ratings:
    +328
    Jakey, the macro is great, thanks :)
     
    #15 MattBrpQc, May 29, 2013
    Last edited: May 29, 2013
  16. GungnirIncarnate

    Builder ⛰️ Ex-President ⚒️⚒️ Premium Upgrade

    Joined:
    Jul 18, 2012
    Messages:
    3,229
    Trophy Points:
    47,340
    Gender:
    Male
    Ratings:
    +481

    Welcome
     
  17. Skwisgaar1991

    Skwisgaar1991 Builder
    Builder ⛰️ Ex-Tycoon ⚜️⚜️⚜️

    Joined:
    Jun 2, 2012
    Messages:
    176
    Trophy Points:
    26,690
    Gender:
    Male
    Ratings:
    +147
    Works perfectly, thanks Jakeyray18
     
  18. GungnirIncarnate

    Builder ⛰️ Ex-President ⚒️⚒️ Premium Upgrade

    Joined:
    Jul 18, 2012
    Messages:
    3,229
    Trophy Points:
    47,340
    Gender:
    Male
    Ratings:
    +481

    Your welcome Skwis.
     
  19. Rsentoki

    Rsentoki Builder
    Builder ⛰️ Ex-Mayor ⚒️⚒️

    Joined:
    Apr 25, 2013
    Messages:
    80
    Trophy Points:
    25,325
    Gender:
    Male
    Ratings:
    +6
    *read* on mac, you copy with command c and paste with control v
     
    #19 Rsentoki, May 31, 2013
    Last edited: May 31, 2013
  20. TheYoungGun

    TheYoungGun Builder
    Builder ⛰️ Ex-EcoLeader ⚜️⚜️⚜️

    Joined:
    Mar 26, 2012
    Messages:
    410
    Trophy Points:
    29,370
    Gender:
    Male
    Ratings:
    +35
    lol I suck! cant figure it out! :/