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

Tree farm problem

Started by theboomboy, 13 April 2016 - 03:44 PM
theboomboy #1
Posted 13 April 2016 - 05:44 PM
I've wanted to make a single tree tree farm using a turtle. I've tested each action in the interactive lua prompt (dig, place, etc.) but the full program doesn't work.


turtle.select(16)
turtle.refuel()
while turtle.getFuelLevel() > 7 do
  turtle.select(16)
  turtle.suckDown()
  turtle.select(1)
  stop = false
  up = 0
  while not stop do
    if turtle.inspectUp == "17" then
      turtle.dig()
      if turtle.detectUp() then
        turtle.digUp()
      end
      turtle.up()
    else
      stop = true
    end
    turtle.select(2)
    turtle.drop()
    turtle.select(16)
    turtle.refuel()
    for i = 0, up do
      turtle.down()
    end
    up = up + 1
    stop = up <= 7
  end
  if not turtle.detect() then
    turtle.select(1)
    turtle.place()
  end
  sleep(10)
end
[\code]

The turtle should go up and down the tree, break the log blocks, put a sapling on the dirt, get refueled from a chest on the bottom, and put the wood in a chest to the side.

I've tried finding a solution for about an hour but it only puts down saplings and waste my fuel...
Bomb Bloke #2
Posted 14 April 2016 - 01:25 AM
turtle.inspectUp == "17"

That'll never be true.

http://www.computercraft.info/wiki/Turtle.inspectUp

There also appears to be no way "up" could be more than 7 before this line is executed:

stop = up <= 7