Jump to content




tree farming

turtle

  • You cannot reply to this topic
No replies to this topic

#1 ZKlack

  • Members
  • 9 posts
  • LocationRiyadh

Posted 19 May 2015 - 12:23 PM

Sorry if you found my English bad I'm Saudi
what will my program do?
it will detect the sapling all the time
if the sapling changed it will clear 5X5X7 area
put another sapling
drop all the wood a chest

setup:
put a sapling in the turtle(slot 1)
and put another one in front of the turtle
put a chest under the turtle
type pastebin run SUD0fAne

pastbin link:
http://pastebin.com/SUD0fAne

programming code:
function floor() --create a function that clear afloor 5X5
  turtle.turnLeft()
  turtle.dig()
  turtle.forward()
  turtle.dig()
  turtle.forward()
  turtle.turnRight()
  for q=1,4 do
		turtle.dig()
		turtle.forward()
  end
  turtle.turnRight()
  for q=1,4 do
		turtle.dig()
		turtle.forward()
  end
  turtle.turnRight()
  for q=1,4 do
		turtle.dig()
		turtle.forward()
  end
  turtle.turnRight()
  turtle.dig()
  turtle.forward()
  turtle.turnRight()
  turtle.dig()
  turtle.forward()
  turtle.dig()
  turtle.forward()
  turtle.dig()
  turtle.forward()
  turtle.turnLeft()
  turtle.dig()
  turtle.forward()
  turtle.dig()
  turtle.forward()
  turtle.turnLeft()
  turtle.dig()
  turtle.forward()
  turtle.dig()
  turtle.forward()
  turtle.turnLeft()
  turtle.dig()
  turtle.forward()
  turtle.turnLeft()
  turtle.dig()
  turtle.back()
end
turtle.select(1)
while true do --make the program running all the time
  while not turtle.compare() do --make the next commands run every time the the tree grow
		turtle.turnRight()
		turtle.turnRight()
		while not turtle.forward() do
		  turtle.attack()
		  turtle.dig()
		end
		turtle.turnRight()
		turtle.turnRight()
		for q=1,6 do
		  while not turtle.up() do
				turtle.attackUp()
				turtle.digUp()
		  end
		end
		for q=1,6 do
		  floor()
		  while not turtle.down() do
				turtle.attackDown()
				turtle.digDown()
		  end
		end
		floor()
		while not turtle.forward() do
		  turtle.attack()
		  turtle.dig()
		end
		for slot=2,16 do
		  turtle.select(slot)
		  turtle.dropDown()
		end
		turtle.select(1)
		turtle.place()
  end
end
if you have any suggests to upgrade the program Reply write it down

Edited by ZKlack, 22 May 2015 - 09:08 PM.






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users