Jump to content




Tree farm problem

turtle

1 reply to this topic

#1 theboomboy

  • New Members
  • 1 posts

Posted 13 April 2016 - 04: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.

[code]
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...

#2 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 14 April 2016 - 12:25 AM

turtle.inspectUp == "17"

That'll never be true.

http://www.computerc...urtle.inspectUp

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

stop = up <= 7






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users