Hello everyone! 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): 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: Spoiler 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. Spoiler 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. Spoiler 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 and also taking requests, not super good at this but I enjoy trying to figure it out! Thanks!
This is a really cool macro, well done! If you don't mind, there are some suggestions I'd like to make ^-^ Spoiler: Suggestions 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 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 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) @#worth = %PICKUPAMOUNT% * .4; @#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: Spoiler: Conditional Macro Code 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: Spoiler: Normal Macro Code 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 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 If you didn't want input, sorry I just like to help if I can (and hopefully this was somewhat helpful... maybe...)
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!
Alrighty so I did a thing 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: Spoiler: Code and some other stuff 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 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
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