Posted 06 December 2012 - 04:16 PM
This is my first time using functions and, for the life of me, I can not figure out what is wrong with my code. Unless I'm going crazy, the 4 means the 4th line of code, and I most certainly have a ( there.
x = 0
function noTree
turtle.dig()
turtle.forward()
turtle.dig()
turtle.forward()
end
function harvest
turtle.dig()
turtle.forward()
repeat
turtle.digUp()
turtle.up()
x = x + 1
until turtle.compareUp() == false
repeat
turtle.down()
x = x - 1
until x == 0
turtle.digDown()
turtle.forward()
end
function harvestStone
turtle.select(13)
if turtle.compare() then
harvest
else
noTree
end
end
function harvestDirt
turtle.select(14)
if turtle.compare() then
harvest
else
noTree
end
end
function harvestCobble
turtle.select(15)
if turtle.compare() then
harvest
else
noTree
end
end
function harvestWood
turtle.select(16)
if turtle.compare() then
harvest
else
noTree
end
end
harvestStone
harvestDirt
harvestCobble
harvestWood