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")
Thread Tools
Thread Tools
-
*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 }$$
-
Winner x 1 - List
-
-
GoatsRMeLife BuilderBuilder ⛰️ Ex-Tycoon ⚜️⚜️⚜️
*cough* @314 ??
-
Code:$${ IF(%PICKUPITEM%="cobblestone") INC(@#totalcobble,%PICKUPAMOUNT%) IF(%@#totalcobble% >= 256) ECHO("/sell cobble") @#totalcobble = 0 ENDIF ENDIF }$$
- 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().
Oh, and this script may not work in a local world, earlier macro mod versions had problems with %PICKUPAMOUNT% in Singleplayer.-
Agree x 1 - List
-
I would recommend also having a toggle key/button to turn on and off this 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 }$$
Code:$${ IF(@sell_cobblestone) IF(%PICKUPITEM% = "Cobblestone") INC(@#totalcobble,%PICKUPAMOUNT%) IF(%@#totalcobble% >= 256) ECHO("/sell cobble") @#totalcobble = 0 ENDIF ENDIF ENDIF }$$
-
Winner x 1 - List
-
-
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.
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.
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 }$$
-
Winner x 1 - List
-
-
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 }$$
-
Winner x 1 - List
-