Auto Sell/Display Pumpkin/Melon Macro Mod

Discussion in 'Classifieds & Ads' started by Amerikathefree, Jul 25, 2016.

?

Are you going to use this?

  1. Yes

    23 vote(s)
    60.5%
  2. No

    2 vote(s)
    5.3%
  3. Maybe

    5 vote(s)
    13.2%
  4. This is confusing wtf

    8 vote(s)
    21.1%
  1. Amerikathefree

    Amerikathefree Builder
    Builder ⛰️ Ex-Mayor ⚒️⚒️

    Joined:
    Jul 12, 2016
    Messages:
    17
    Trophy Points:
    10,210
    Gender:
    Male
    Ratings:
    +11
    Hello everyone! :D
    UPDATE ON BOTTOM OF POST FOR AUTO MELON ATTACKING
    With a little (alot) of help from SioniannSun (to make it much more compact) I have made a macro that shows you how many of an item you have (in this instance pumpkins and melons, how much it is worth , and it auto sells at 1500!

    Here is a youtube video on how to set it all up, or you can use the instructions below :)
    The Final Product Should Look Like This (minus the coordinates, that's someone else's mod):

    [​IMG]

    For OnPickupItem
    Code:
    $$<PandM.txt>
    
    Then you hit the edit file, create a new file called PandM, it will open up the text editor and you will type or copy/paste
    Code:
    $${
    IFMATCHES(%PICKUPID%, "pumpkin");
        @#pumpkin = %@#pumpkin% + %PICKUPAMOUNT%;
        @#pumpworth = (%@#pumpkin% * 2) / 5;
        IF(@#pumpkin >= 1500);
            ECHO("/sell pumpkin");
            @#pumpkin = 0;
            @#pumpworth = 0;
        ENDIF;
    ENDIF;
    IFMATCHES(%PICKUPID%, "melon");
        @#melons = %@#melons% + %PICKUPAMOUNT%;
        @#melworth = (%@#melons% * 2);
        IF(@#melons >= 1500);
            ECHO("/sell melon");
            @#melons = 0;
            @#melworth = 0;
        ENDIF;
    ENDIF;
        SETLABEL(pumpkin, "Pumpkins: %@#pumpkin%");
        SETLABEL(pumpworth, "Worth: $ %@#pumpworth%");
        SETLABEL(melons, "Melons: %@#melons%");
        SETLABEL(melworth, "Worth: $ %@#melworth%");
    }$$
    After all of that is done it's time to set up the gui, so go into the gui editor located here:
    [​IMG]
    Double click ingame

    Then with the button on the bottom left with the plus sign, you can rearrange the grid if you want, or just click it and select add label.
    [​IMG]
    Choose which grid spot you want it to be at and then make the control name pumpkin, melons, pumpworth, and melworth (make sure you set 4 different labels with the 4 names to 4 different locations) and make sure that there is nothing in the label text and there you can change the font color, background color, alignment, ect.

    [​IMG]
    I also recommend setting a button to set both values to 0 just incase anything happens, you can do that by selecting a key on the main screen and then in the command box putting in:
    Code:
    $${
        ECHO("/sell pumpkin");
        ECHO("/sell melon");
        @#pumpkin = 0;
        @#pumpworth = 0;
        @#melons = 0;
        @#melworth = 0;
        SETLABEL(pumpkin, "Pumpkins: %@#pumpkin%");
        SETLABEL(pumpworth, "Worth: $ %@#worth%");
        SETLABEL(melons, "Melons: %@#melons%");
        SETLABEL(melworth, "Worth: $ %@#melworth%");
    }$$
    
    Feel free to donate to me if this helped you :D and also taking requests, not super good at this but I enjoy trying to figure it out! Thanks!
     
    #1 Amerikathefree, Jul 25, 2016
    Last edited: Aug 5, 2016
  2. Samurai_N

    Samurai_N Builder
    Builder ⛰️ Ex-Tycoon ⚜️⚜️⚜️

    Joined:
    May 2, 2016
    Messages:
    202
    Trophy Points:
    11,740
    Gender:
    Male
    Ratings:
    +87
    Omg so useful thanks
     
    • Optimistic Optimistic x 1
    • List
  3. destroyer2441

    destroyer2441 Builder
    Builder ⛰️ Ex-EcoLegend ⚜️⚜️⚜️⚜️ Prestige ⭐ I ⭐ Premium Upgrade

    Joined:
    Jan 5, 2015
    Messages:
    239
    Trophy Points:
    53,810
    Gender:
    Male
    Ratings:
    +84
    this is an amazing macro. It is so helpful being able to auto sell it
     
  4. SionainnSun

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

    Joined:
    Apr 3, 2016
    Messages:
    71
    Trophy Points:
    10,400
    Gender:
    Female
    Ratings:
    +30
    This is a really cool macro, well done! :) If you don't mind, there are some suggestions I'd like to make ^-^
    For this, all you need to do is: $$<Loops.txt>. (Or, if the $${ and }$$ aren't in Loops.txt, you can do $${$$<Loops.txt>}$$)

    I noticed you didn't use percent signs around any variable names (such as PICKUPAMOUNT.) As far as I know, you have to, but your macro seems to work without doing so o_O I would put them though, because you should have to (I think...)

    You also entered the condition as PICKUPITEM = "Pumpkin". As far as I'm aware, PICKUPITEM isn't a variable, it's PICKUPID... but again, apparently your macro works :p

    And, finally, in your ECHO commands, you didn't put quotes around the message (/sell pumpkin.) I, again, was under the impression that it was necessary to do so, but if you've tested the macro and it works, it's apparently not necessary... I would still do it though, just for the sake of style.

    I can't test at the moment because I can't go on Minecraft, but I would think at least one of these would work: The first is obviously the best, since you're using its actual worth (.4 dollars). However, if decimals don't work for some reason, the second example below should work (since 2/5 = .4)
    1. @#worth = %PICKUPAMOUNT% * .4;
    2. @#worth = %PICKUPAMOUNT% * 2 / 5;
    For this, I would recommend just making a text file with the code in it, because (for me, at least) that makes it easier to a) edit it and b) see what's actually going on--readable code is always good ;)
    Also, I'm not sure why you made it two separate scripts... it should work as only one script, I believe. Basically, I would recommend something like this:
    Code:
    $${
    @#pumpkin = @#pumpkin + %PICKUPAMOUNT%;
    @#worth = @#worth + %PICKUPAMOUNT% * .4;
    IF(@#pumpkin >= 1000);
        ECHO("/sell pumpkin");
        @#pumpkin = 0;
        @#worth = 0;
    ENDIF;
    }$$
    
    And then, again, all you would have to do is bind it to onItemPickup next to "IF TRUE" using $$<fileName.txt>.

    If you didn't want to use the conditional macro thing, and just wanted to use the regular one, you could also do this:
    Code:
    $${
    IFMATCHES(%PICKUPID%, "pumpkin");
        @#pumpkin = @#pumpkin + %PICKUPAMOUNT%;
        @#worth = @#worth + %PICKUPAMOUNT% * .4;
        IF(@#pumpkin >= 1000);
            ECHO("/sell pumpkin");
            @#pumpkin = 0;
            @#worth = 0;
        ENDIF;
    ENDIF;
    }$$
    And you would just bind it like above, except in the normal macro tab.

    Again, I haven't tested any of this code because I can't go on Minecraft at the moment, but I'm fairly sure it should work :laugh: If it doesn't, just let me know and I'll see what I can do, I don't have a great track record of making macros work on the first try :confused:
    If you didn't want input, sorry :X3: I just like to help if I can (and hopefully this was somewhat helpful... maybe...)
     
  5. Amerikathefree

    Amerikathefree Builder
    Builder ⛰️ Ex-Mayor ⚒️⚒️

    Joined:
    Jul 12, 2016
    Messages:
    17
    Trophy Points:
    10,210
    Gender:
    Male
    Ratings:
    +11
    Hey! Thanks for the input! And honestly I tried doing alot of the things that you recommended and for some reason they just would not work doing them the "correct" way. (like putting the conditional macro in a txt file and putting the percent signs around pickupamounts) if you want to test it and figure out a way to make it work without being so messy I would be super appreciative! :)
     
  6. SionainnSun

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

    Joined:
    Apr 3, 2016
    Messages:
    71
    Trophy Points:
    10,400
    Gender:
    Female
    Ratings:
    +30
    Alrighty so I did a thing :D I tested it and everything, and I also got it all in one script (setting the labels), because it was inefficient to run on a constant loop like that. So, the final product:
    Code:
    $${
    IFMATCHES(%PICKUPID%, "pumpkin");
        @#pumpkin = %@#pumpkin% + %PICKUPAMOUNT%;
        @#worth = (%@#pumpkin% * 2) / 5;
        IF(@#pumpkin >= 1000);
            ECHO("/sell pumpkin");
            @#pumpkin = 0;
            @#worth = 0;
        ENDIF;
        SETLABEL(Worth, "Worth: %@#worth%");
        SETLABEL(Amount, "Pumpkins: %@#pumpkin%");
    ENDIF;
    }$$
    
    As far as I can figure, decimals just aren't supported at all in the macro mod. What it does instead is takes the number with a decimal and cuts it off just before the decimal--not rounding, but similar. I.e., 62.20 would become 62 (it just cuts off the decimal), but 62.8 would also become 62, not 63 (even though it's closer to 63.) The result is that the script just displays the worth of the pumpkins to the nearest whole number, but always rounds down. However, the most it's ever off by is 80 cents, so it shouldn't be too much of an issue, I don't think :)

    In your original post, you said both @#pumpkin and @#worth got set to zero when you joined the server, but I didn't see anywhere in your code where that happened. It would be very simple to do (as would setting both variables to zero whenever you enter the "/sell pumpkin" command), but that would require binding a script to onJoinGame and onSendChat respectively, and I wasn't sure if you wanted to have to deal with multiple scripts like that :p If you don't do that, there's no need to make the variables global (with the @ prefix), but I left it in case you want to do anything in different script.
    If this works for you, feel free to use it, and if not, I'll try to fix whatever bugs there are. It seemed to work pretty well for me :happy:
     
  7. Amerikathefree

    Amerikathefree Builder
    Builder ⛰️ Ex-Mayor ⚒️⚒️

    Joined:
    Jul 12, 2016
    Messages:
    17
    Trophy Points:
    10,210
    Gender:
    Male
    Ratings:
    +11
    Not sure what you did that was different from me, but it worked! And now I can put the melon one in there as well! Thank you so much! I'll redo the video and the post. Oh and I didnt say they would be set to zero once you join the game, I just set a button to do /sell (item) and that sets the values to 0
     
    #7 Amerikathefree, Jul 27, 2016
    Last edited: Jul 27, 2016
  8. heartsandwrists

    heartsandwrists Builder
    Builder ⛰️ Ex-President ⚒️⚒️

    Joined:
    Dec 26, 2015
    Messages:
    93
    Trophy Points:
    10,890
    Gender:
    Female
    Ratings:
    +134
    this is cool :O you should do something like this for cocoa
     
  9. SionainnSun

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

    Joined:
    Apr 3, 2016
    Messages:
    71
    Trophy Points:
    10,400
    Gender:
    Female
    Ratings:
    +30
    Glad to hear it :D if there's anything else I can help with, feel free to let me know :)
     
  10. mafhewm

    mafhewm Builder
    Builder ⛰️ Ex-Mayor ⚒️⚒️

    Joined:
    Aug 8, 2013
    Messages:
    118
    Trophy Points:
    29,500
    Gender:
    Male
    Ratings:
    +27
    best macro m8
     
  11. Amerikathefree

    Amerikathefree Builder
    Builder ⛰️ Ex-Mayor ⚒️⚒️

    Joined:
    Jul 12, 2016
    Messages:
    17
    Trophy Points:
    10,210
    Gender:
    Male
    Ratings:
    +11
    Updated with auto melon attacker! :D (Attacks if you are looking at melons)