This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Lord_Spelunky's profile picture

Auto Crafting Bread Turtle, I Know Advanced ;)

Started by Lord_Spelunky, 25 July 2013 - 12:03 PM
Lord_Spelunky #1
Posted 25 July 2013 - 02:03 PM
I made a program where you put wheat a chest at the top then it autocrafts as much as it can into bread
then puts it into a chest at the bottom
here is the pastebin:http://pastebin.com/X3bDvFXA

If you don't wanna use pastebin here is the code:
Spoiler

function sort(slot)	
  turtle.select(slot)	
  turtle.suckUp()	
  current = turtle.getItemCount(slot)	
  aim = eachSlot + 2
  while current >= aim do
	turtle.dropUp(1)	  
	current = turtle.getItemCount(slot)	
  end  
end  
turtle.select(1)  
if turtle.suckUp() == false then  
sleep(10)  
end  
allWheat = turtle.getItemCount(1)  
unEachSlot = allWheat / 3  
eachSlot = math.floor(unEachSlot)
print(eachSlot)
turtle.dropUp()
sort(5)
sort(6)
sort(7)
turtle.select(1)
turtle.craft(eachSlot)
turtle.dropDown()

Ps: Thanks ZudoHackz for teaching me how to use spoilers ;)/>
Zudo #2
Posted 25 July 2013 - 02:38 PM
To put stuff in spoilers, use {spoiler} and {/spoiler} but replace the {} with []
TimTheRedstoner #3
Posted 31 July 2013 - 09:30 PM
thats cool PM me me if you want to see my code it will craft any tool and bread also made a gui for it you can select how many you want also the gui includes more i wade it so you run it on a crafty turtle but cool post!
Tascavengur #4
Posted 01 August 2013 - 10:33 AM
Nice one!
btw you can drop the comparison in the if clauses. I see most people use it, but LUA does not need it:
if turtle.suckUp() == false then
would make
if not turtle.suckUp() then
saves you a comparison ;-)