$${

set(@craft3x3)

// This script crafts items in a 3x3 grid. Useful for crafting hay bales, gold blocks, etc, etc

// The first (top left) slot in your inventory should be filled with the item to be placed in the crafting grid

// Here's a screenshot of the slot it should be placed in: http://prntscr.com/357f54

// Do not have partial stacks of this item anywhere in your inventory

// Face a crafting bench before launching the macro

// Config

// Wait this many milliseconds between actions. ttk recommended that I set this to 500 for civcraft, as to not violate cheating policy

#wait = 500

// Make this many stacks of the output (set this to "$$?" to open a text box in game to define it when you launch the script)

&make = $$?

// End Config

// Do not edit below this line

key(use);

wait(500ms);

getslotitem(10,&item);

if(%&item% != "air");

for(#for,1,%&make%);

for(#forcraft,1,9);

for(#forxp,10,44);

getslot(%&item%,#stackslot,%#forxp%);

getslotitem(%#stackslot%,#id,#stacksize);

if(%#stacksize% = 64);

slotclick(%#stackslot%);

wait(%#wait%ms);

break();

else;

gui();

@&craft3x3 = false

log("Out of items");

stop();

endif;

next;

slotclick(%#forcraft%);

wait(%#wait%ms);

next;

slotclick(0,1,true);

next;

else;

log("No item detected in first slot");

gui();

wait(500ms);

@&craft3x3 = false

stop();

endif;

gui();

unset(@craft3x3)