Posted 08 August 2013 - 06:08 PM
Hi there i have recently downloaded CC and have watched and read many tutorials and thought i would give a shot at making my own automated tree farm. This was all going good until i have reached the point w tree here i just dont know whats wrong.
Basicly there is no errors, it plants the saplings and then sleeps and checks to see if they have grown. The problem is that when the turtle chops down the tree it doesnt come back down. Its like it just ignores that part of the code for some reason any help would be appreciated.
I have highlighted the part in red for you.
-- How many trees to plant
print("Please put dirt in slot 1, saplings in slot 2 and logs in slot 3.\n")
print("How many trees do you want planted?")
local info = io.read()
local dirt, sapling, log = 1, 2, 3
-- Planting first set of trees
for i = 1,info do
turtle.forward()
turtle.forward()
turtle.forward()
turtle.turnRight()
turtle.forward()
turtle.digDown()
turtle.select(dirt)
turtle.placeDown()
turtle.select(sapling)
turtle.back()
turtle.place()
turtle.turnLeft()
end
-- Moving to position
turtle.forward()
turtle.forward()
turtle.forward()
turtle.turnRight()
turtle.forward()
turtle.forward()
turtle.turnRight()
-- Check to see if trees are grown
while true do
os.sleep(10)
for i = 1, info do
turtle.select(log)
turtle.forward()
turtle.forward()
turtle.forward()
turtle.turnRight()
-- If tree is grown
if turtle.compare() then
turtle.dig()
turtle.forward()
while turtle.detectUp() do
print("Digging up")
turtle.digUp()
turtle.up()
end
while not turtle.detectDown do
print("Going down")
turtle.down()
end
turtle.back()
turtle.select(sapling)
turtle.place()
end
turtle.turnLeft()
end
-- Round the corner
turtle.forward()
turtle.forward()
turtle.forward()
turtle.turnRight()
turtle.forward()
turtle.forward()
turtle.turnRight()
end