I'm having some problems with this small macro.. I want this macro to do "/sell Cobblestone" after every 60sec or after so many cobblestone are picked up(Like 26). I've been trying to find out what I did wrong in the code. Code: DO() LOG("Auto Sell Cobblestone On") IF(PICKUPID = 4) ECHO("/sell Cobblestone") WAIT(60) LOOP() endif() LOG("Auto Sell Cobblestone Off")
*shrug* Doesn't loop every 60 seconds but sells after you pick up 4 stacks of cobble. Bind to onPickupItem Code: $${ IF(%PICKUPID%="cobblestone") INC(#totalcobble,%PICKUPAMOUNT%) IF(%#totalcobble% >= 256) ECHO(/sell cobble) SET(#totalcobble,0) ENDIF ENDIF }$$ idek what I'm doing
I haven't tested it yet, but... I guess. I have no idea how much better my idea is, though. Code: $${ IF(%PICKUPITEM%="cobblestone") INC(@#totalcobble,%PICKUPAMOUNT%) IF(%@#totalcobble% >= 256) ECHO("/sell cobble") @#totalcobble = 0 ENDIF ENDIF }$$ Changes made to Mel's macro: Use of %PICKUPITEM%. ID values are deprecated since quite a few MC versions. Not to mention that you would require the numeric ID instead. @#totalcobble as a global variable. A different script instance is executed each time you pick up an item, so a local variable should always start as 0 in this script, discarding the previous value. ECHO with proper quotation marks. An easier way to read SET(). As always: Not tested, no warranty. Oh, and this script may not work in a local world, earlier macro mod versions had problems with %PICKUPAMOUNT% in Singleplayer.
I would recommend also having a toggle key/button to turn on and off this script. Spoiler: Bind to Key/Button to toggle the script Code: $${ IF(mining) UNSET(mining) UNSET(@sell_cobblestone) LOG("&fAuto Sell Cobblestone - &4Off") ELSE SET(mining) SET(@sell_cobblestone) LOG("&fAuto Sell Cobblestone - &aOn") @#totalcobble = 0 ENDIF }$$ Spoiler: Bind to onPickupItem Event Code: $${ IF(@sell_cobblestone) IF(%PICKUPITEM% = "Cobblestone") INC(@#totalcobble,%PICKUPAMOUNT%) IF(%@#totalcobble% >= 256) ECHO("/sell cobble") @#totalcobble = 0 ENDIF ENDIF ENDIF }$$
I'm a little confused... a new instance of the macro is executed whenever you activate it, so shouldn't it discard the content of "mining" because it is a local variable? By the way, your post has the ID 900000 on the forum. Congratulations!
Your code works.. But how would I add other blocks? I tried this and it doesn't sell anything but cobby? Code: $${ IF(@sell_cobblestone) IF(%PICKUPITEM% = "Cobblestone") INC(@#totalcobble,%PICKUPAMOUNT%) IF(%@#totalcobble% >= 256) ECHO("/sell cobble") @#totalcobble = 0 ENDIF ENDIF IF(%PICKUPITEM% = "Diorite") INC(@#totalcobble,%PICKUPAMOUNT%) IF(%@#totalcobble% >= 256) ECHO("/sell Diorite") @#totalcobble = 0 ENDIF ENDIF IF(%PICKUPITEM% = "Andesitee") INC(@#totalcobble,%PICKUPAMOUNT%) IF(%@#totalcobble% >= 256) ECHO("/sell Andesitee") @#totalcobble = 0 ENDIF ENDIF IF(%PICKUPITEM% = "Dirt") INC(@#totalcobble,%PICKUPAMOUNT%) IF(%@#totalcobble% >= 256) ECHO("/sell Dirt") @#totalcobble = 0 ENDIF ENDIF ENDIF }$$
You needed to change the variables to each item. Spoiler Code: $${ IF(@sell_cobblestone) LOG("%PICKUPITEM%") IF(%PICKUPITEM% = "Cobblestone") INC(@#totalcobble,%PICKUPAMOUNT%) IF(%@#totalcobble% >= 256) ECHO("/sell cobble") @#totalcobble = 0 ENDIF ENDIF IF(%PICKUPITEM% = "Andesite") INC(@#totalandesite,%PICKUPAMOUNT%) IF(%@#totalandesite% >= 256) ECHO("/sell andesite") @#totalandesite = 0 ENDIF ENDIF IF(%PICKUPITEM% = "Dirt") INC(@#totaldirt,%PICKUPAMOUNT%) IF(%@#totaldirt% >= 256) ECHO("/sell dirt") @#totaldirt = 0 ENDIF ENDIF IF(%PICKUPITEM% = "Diorite") INC(@#totaldiorite,%PICKUPAMOUNT%) IF(%@#totaldiorite% >= 256) ECHO("/sell diorite") @#totaldiorite = 0 ENDIF ENDIF ENDIF }$$ You would also need to reset the totals to zero on the other script. Spoiler Code: $${ IF(mining) UNSET(mining) UNSET(@sell_cobblestone) LOG("&fAuto Sell Cobblestone - &4Off") ELSE SET(mining) SET(@sell_cobblestone) LOG("&fAuto Sell Cobblestone - &aOn") @#totalcobble = 0 @#totalandesite = 0 @#totaldirt = 0 @#totaldiorite = 0 ENDIF }$$
Opps, Code: $${ IF(@sell_cobblestone) IF(%PICKUPITEM% = "Cobblestone") INC(@#totalcobble,%PICKUPAMOUNT%) IF(%@#totalcobble% >= 4) ECHO("/sell cobble") @#totalcobble = 0 ENDIF ENDIF IF(%PICKUPITEM% = "Andesite") INC(@#totalandesite,%PICKUPAMOUNT%) IF(%@#totalandesite% >= 4) ECHO("/sell andesite") @#totalandesite = 0 ENDIF ENDIF IF(%PICKUPITEM% = "Dirt") INC(@#totaldirt,%PICKUPAMOUNT%) IF(%@#totaldirt% >= 4) ECHO("/sell dirt") @#totaldirt = 0 ENDIF ENDIF IF(%PICKUPITEM% = "Diorite") INC(@#totaldiorite,%PICKUPAMOUNT%) IF(%@#totaldiorite% >= 4) ECHO("/sell diorite") @#totaldiorite = 0 ENDIF ENDIF ENDIF }$$