All-in-one Lotto Macro

Discussion in 'Basic Tutorials' started by rockboy2000, Dec 31, 2015.

  1. rockboy2000

    rockboy2000 Mayor
    Mayor ⛰️⛰️ Ex-Tycoon ⚜️⚜️⚜️ Premium Upgrade

    Joined:
    Oct 19, 2012
    Messages:
    1,344
    Trophy Points:
    50,410
    Gender:
    Male
    EcoDollars:
    $0
    Ratings:
    +310
    With me back playing on ECC, I thought I'd properly share a lottery macro I had made over a year ago, with me finally managing to fix the few bugs it had.

    This macro provides you with the pot amount, time till draw, last pot winner and last pot amount.

    [​IMG]

    1. Navigate to the text editor and create 3 files
    [​IMG]
    [​IMG]

    The first to create is "lotto.txt", it is important that you keep the exact names:
    Code:
    $${
    IFMATCHES(%&chat%,^\[LOTTERY\] Congratulations go to (.*) for winning \$[0-9]+ with [0-9]+ tickets\.);
        MATCH(%&chat%,^\[LOTTERY\] Congratulations go to (.*) for winning \$([0-9]+) with ([0-9]+) tickets\.,{@&winner,@#lotwin,#wintix});
        @#pot=0;
        STOP(timer);
        @#seccount=0;
        @#mincount=15;
        EXEC(lottotimer.txt,timer);
        SETLABEL(lot,Last Winner: &5%@&winner%\n&fLast Pot: &2$%@#lotwin%\n&fPot: &a$%@#pot%\n&fDraw in: &b%@#mincount%min &b%@#seccount%sec,lot);
    ENDIF;
    IFMATCHES(%&chat%,^\[LOTTERY\] Draw in: [0-9]+ seconds?);
        MATCH(%&chat%,^\[LOTTERY\] Draw in: ([0-9]+) seconds?,{#countsec});
        @#mincount=0;
        @#seccount=#countsec;
    ENDIF;
    IFMATCHES(%&chat%,^\[LOTTERY\] Draw in: [0-9]+ minutes?\, and [0-9]+ seconds?);
        MATCH(%&chat%,^\[LOTTERY\] Draw in: ([0-9]+) minutes?\, and ([0-9]+) seconds?,{#countmin,#countsec});
        @#mincount=#countmin;
        @#seccount=#countsec;
    ENDIF;
    IFMATCHES(%&chat%,^\[LOTTERY\] (.*) just bought [0-9]+ tickets?);
        MATCH(%&chat%,^\[LOTTERY\] (.*) just bought ([0-9]+) tickets?,{&username,#tickets});
        #amount=#tickets*850;
        @#pot=@#pot+#amount;
        SETLABEL(lot,Last Winner: &5%@&winner%\n&fLast Pot: &2$%@#lotwin%\n&fPot: &a$%@#pot%\n&fDraw in: &b%@#mincount%min &b%@#seccount%sec,lot);
    ENDIF;
    IFMATCHES(%&chat%,^\[LOTTERY\] (.*) just bought [0-9]+ tickets?! Draw in [0-9]+m [0-9]+s);
        MATCH(%&chat%,^\[LOTTERY\] (.*) just bought [0-9]+ tickets?! Draw in ([0-9]+)m ([0-9]+)s,{&username,#countmin,#countsec});
        @#mincount=#countmin;
        @#seccount=#countsec;
        SETLABEL(lot,Last Winner: &5%@&winner%\n&fLast Pot: &2$%@#lotwin%\n&fPot: &a$%@#pot%\n&fDraw in: &b%@#mincount%min &b%@#seccount%sec,lot);
    ENDIF;
    IFMATCHES(%&chat%,^\[LOTTERY\] (.*) just bought [0-9]+ tickets?! Draw in [0-9]+s);
        MATCH(%&chat%,^\[LOTTERY\] (.*) just bought ([0-9]+) tickets?! Draw in ([0-9]+)s,{&username,#tickets,#countsec});
        @#mincount=0;
        @#seccount=#countsec;
        SETLABEL(lot,Last Winner: &5%@&winner%\n&fLast Pot: &2$%@#lotwin%\n&fPot: &a$%@#pot%\n&fDraw in: &b%@#mincount%min &b%@#seccount%sec,lot);
    ENDIF;
    IFMATCHES(%&chat%,^\[LOTTERY\] Last winner: (.*) \$[0-9]+);
        MATCH(%&chat%,^\[LOTTERY\] Last winner: (.*) \$([0-9]+),{@&winner,@#lotwin});
        SETLABEL(lotpot,Last Winner: &5%@&winner%\n&fLast Pot: &2$%@#lotwin%\n&fPot: &a$%@#pot%\n&fTime: %@#minutes%m %@#seconds%s ,lotpot);
    ENDIF;
    IFMATCHES(%&chat%,^\[LOTTERY\] There is currently \$[0-9]+ in the pot\.);
        MATCH(%&chat%,^\[LOTTERY\] There is currently \$([0-9]+) in the pot\.,{@#pot});
        SETLABEL(lot,Last Winner: &5%@&winner%\n&fLast Pot: &2$%@#lotwin%\n&fPot: &a$%@#pot%\n&fDraw in: &b%@#mincount%min &b%@#seccount%sec,lot);
    ENDIF;
    }$$
    Next create "lottoloop.txt":
    Code:
    $${
    DO;
        SETLABEL(lot,Last Winner: &5%@&winner%\n&fLast Pot: &2$%@#lotwin%\n&fPot: &a$%@#pot%\n&fDraw in: &b%@#mincount%min &b%@#seccount%sec,lot);
        WAIT(10t)
    LOOP;
    }$$
    And finally "lottotimer.txt":
    Code:
    $${
    DO;
        WAIT(19t);
        IF(%@#seccount%=0);
            INC(@#seccount,60);
            DEC(@#mincount);
        ENDIF;
        DEC(@#seccount);
        IF(%@#mincount%=0);
            IF(%@#seccount%=0);
                STOP(timer);
            ENDIF;
        ENDIF;
        SETLABEL(lot,Last Winner: &5%@&winner%\n&fLast Pot: &2$%@#lotwin%\n&fPot: &a$%@#pot%\n&fDraw in: &b%@#mincount%min &b%@#seccount%sec,lot);
    LOOP;
    }$$
    2. Navigate to the GUI editor for the ingame screen
    [​IMG]
    [​IMG]

    3. Create a label with "lot" in the Control Name and Binding
    [​IMG]

    4. Navigate to the "onChat" event and paste "$$<lotto.txt>" into the box at the bottom using a "|" to separate it from anything else you have
    [​IMG]

    5. Navigate to the "onJoinGame" event and paste the code below into the box at the bottom, again using "|" to separate it from any code you have already
    Code:
    $${ECHO(/lot);EXEC(lottotimer.txt,timer);EXEC(lottoloop.txt,lottoloop)}$$
    [​IMG]

    6. Disconnect and rejoin the server and you should be good to go!


    I do plan on adding features such as it telling you how many tickets you have in the pot and your percentage chance at winning. If you have any issues or suggestions please post below!

    Thanks to @Videowiz92 for his help all that time ago :)
     
    #1 rockboy2000, Dec 31, 2015
    Last edited: Jan 4, 2016
  2. Videowiz92

    Mythic ⚔️ I ⚔️ ECC Benefactor President ⛰️⛰️ Ex-EcoLegend ⚜️⚜️⚜️⚜️ Prestige ⭐⭐ X ⭐⭐ Gameplay Architect Premium Upgrade

    Joined:
    Jan 30, 2012
    Messages:
    3,021
    Trophy Points:
    77,660
    Gender:
    Male
    Ratings:
    +1,183
    Wow I can't believe this still exists after all these years :)
     
  3. UnitedStates2

    UnitedStates2 Builder
    Builder ⛰️ Ex-President ⚒️⚒️ Gameplay Architect Premium Upgrade

    Joined:
    Nov 30, 2014
    Messages:
    5,883
    Trophy Points:
    67,660
    Ratings:
    +6,302
    It should be lottotimer.txt, not timer.txt.

    Anyway, this macro is interesting... When I do /lot, there's three possible things that can occur - The timer going down to 0min 0sec and staying there, the timer going into negative time/numbers or the macro actually correctly telling the time until the next lotto draw. Fix this?
     
    #3 UnitedStates2, Jan 4, 2016
    Last edited: Jan 4, 2016
  4. rockboy2000

    rockboy2000 Mayor
    Mayor ⛰️⛰️ Ex-Tycoon ⚜️⚜️⚜️ Premium Upgrade

    Joined:
    Oct 19, 2012
    Messages:
    1,344
    Trophy Points:
    50,410
    Gender:
    Male
    EcoDollars:
    $0
    Ratings:
    +310
    Will edit the lottotimer.txt thing, thanks. In terms of the bugs you are experiencing I can't re-create them, so I'm not sure if you are doing something wrong?
     
    #4 rockboy2000, Jan 4, 2016
    Last edited: Jan 4, 2016
  5. iTzXtremeGaming

    iTzXtremeGaming Resident
    Resident ⛰️ Ex-EcoLegend ⚜️⚜️⚜️⚜️ Prestige ⭐ III ⭐

    Joined:
    Mar 24, 2013
    Messages:
    1,404
    Trophy Points:
    62,660
    Gender:
    Male
    Ratings:
    +1,706
    This is impressive, great work!
     
  6. glitch_404

    glitch_404 The Legendary Resident
    Builder ⛰️ Ex-Resident ⚒️ Premium Upgrade

    Joined:
    Feb 11, 2016
    Messages:
    11
    Trophy Points:
    20,165
    Gender:
    Male
    Ratings:
    +25
    Very nice job but I get the following error: [​IMG]
     
  7. rockboy2000

    rockboy2000 Mayor
    Mayor ⛰️⛰️ Ex-Tycoon ⚜️⚜️⚜️ Premium Upgrade

    Joined:
    Oct 19, 2012
    Messages:
    1,344
    Trophy Points:
    50,410
    Gender:
    Male
    EcoDollars:
    $0
    Ratings:
    +310
    Okay I'll look into it when I find the time :)
     
  8. glitch_404

    glitch_404 The Legendary Resident
    Builder ⛰️ Ex-Resident ⚒️ Premium Upgrade

    Joined:
    Feb 11, 2016
    Messages:
    11
    Trophy Points:
    20,165
    Gender:
    Male
    Ratings:
    +25
    Thankyou.
     
  9. freddyagogog

    freddyagogog Ex-SMod
    ECC Sponsor Builder ⛰️ Ex-EcoLegend ⚜️⚜️⚜️⚜️ Prestige ⭐ II ⭐ Premium Upgrade

    Joined:
    Jun 7, 2014
    Messages:
    883
    Trophy Points:
    47,910
    Gender:
    Male
    EcoDollars:
    $71,112
    Ratings:
    +512
    Same error to me...
     
  10. OppyStoppy

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

    Joined:
    Mar 16, 2015
    Messages:
    1,336
    Trophy Points:
    31,355
    Gender:
    Male
    EcoDollars:
    $0
    Ratings:
    +636
    Same here
     
  11. Coolslammer3

    Coolslammer3 Builder
    Builder ⛰️ Ex-President ⚒️⚒️

    Joined:
    Dec 1, 2013
    Messages:
    268
    Trophy Points:
    21,440
    Gender:
    Male
    Ratings:
    +74
    Could you post those other macros, they look really cool.
     
  12. spencer23baller

    spencer23baller Builder
    Builder ⛰️ Ex-President ⚒️⚒️

    Joined:
    Oct 8, 2014
    Messages:
    63
    Trophy Points:
    14,570
    Gender:
    Male
    Ratings:
    +29
    This macro doesnt work for me. Everytime I try to join ECC I get kicked and it says "You Are Not Allowed To Spam In Chat".
     
  13. SionainnSun

    SionainnSun Mayor
    Mayor ⛰️⛰️ Ex-Mayor ⚒️⚒️

    Joined:
    Apr 3, 2016
    Messages:
    71
    Trophy Points:
    10,400
    Gender:
    Female
    Ratings:
    +30
    Make sure you have "$${" (without the quotes) at the beginning of every text file and "}$$" (again without the quotes) at the end of every text file, or else the mod will output all the code into chat, which would then get you kicked for spamming. That's usually what's going on for me, anyway
     
  14. spencer23baller

    spencer23baller Builder
    Builder ⛰️ Ex-President ⚒️⚒️

    Joined:
    Oct 8, 2014
    Messages:
    63
    Trophy Points:
    14,570
    Gender:
    Male
    Ratings:
    +29
    but how can I get on ECC If I get kicked the second I join
     
  15. SionainnSun

    SionainnSun Mayor
    Mayor ⛰️⛰️ Ex-Mayor ⚒️⚒️

    Joined:
    Apr 3, 2016
    Messages:
    71
    Trophy Points:
    10,400
    Gender:
    Female
    Ratings:
    +30
    Go on your opening Minecraft screen (the one that looks like this):
    [​IMG]
    and then click on Options...>Controls>(scroll all the way down)>Macro Settings...
    By doing this, you can either edit the script and add $${ }$$ or unbind the script from the event to prevent it from running at all (either of which should allow you to connect to ECC without getting kicked.)
     
    #15 SionainnSun, Aug 28, 2016
    Last edited: Aug 28, 2016
  16. spencer23baller

    spencer23baller Builder
    Builder ⛰️ Ex-President ⚒️⚒️

    Joined:
    Oct 8, 2014
    Messages:
    63
    Trophy Points:
    14,570
    Gender:
    Male
    Ratings:
    +29
  17. spencer23baller

    spencer23baller Builder
    Builder ⛰️ Ex-President ⚒️⚒️

    Joined:
    Oct 8, 2014
    Messages:
    63
    Trophy Points:
    14,570
    Gender:
    Male
    Ratings:
    +29
    Can you tell me how to fix it on LiteLoader?