Posted 06 February 2013 - 08:52 AM
I am making a program that farms trees. I am adding a part to that checks if there are any more saplings. I am fairly new to lua but I have tried to fix the error myself and can't.
Code:
Code:
local bExit = false
local function checkItems()
turtle.select(1)
turtle.compareTo(15)
if turtle.compareTo() == false then
bExit = true
else
end
end
local function plantTree()
turtle.select(1)
turtle.place()
turtle.select(2)
turtle.place()
end
local function cutTree()
turtle.dig()
turtle.forward()
turtle.suck()
turtle.digUp()
turtle.suck()
turtle.up()
turtle.digUp()
turtle.suck()
turtle.up()
turtle.digUp()
turtle.suck()
turtle.up()
turtle.digUp()
turtle.suck()
turtle.up()
turtle.digUp()
turtle.suck()
turtle.up()
turtle.digUp()
turtle.suck()
turtle.up()
turtle.digUp()
turtle.suck()
end
local function returnToStart()
turtle.down()
turtle.down()
turtle.down()
turtle.down()
turtle.down()
turtle.down()
turtle.down()
turtle.back()
end
while not bExit do
checkItems()
plantTree()
cutTree()
returnToStart()
end