Posted 10 April 2013 - 12:43 PM
I know this error usualy happens when I call a function before I've declared it, but I didn't do it so…
Any Idea? :xxx
print("Plant trees? Y or N?")
modo=io.read()
-- turtle inv: slot1=fuel slot2=bonemeal slot3=log slot4=sapling rest=1 piece of wood
function comparar()
turtle.select(3)
while turtle.compare() do
turtle.dig()
turtle.forward()
end
end
function plantar()
turtle.select(4)
if turtle.detect()==false then
turtle.place()
turtle.select(2)
turtle.place()
end
end
function detectar()
while turtle.detectUp() do
turtle.digUp()
turtle.up()
end
end
function voltar()
while not turtle.detectDown() do
turtle.down()
end
turtle.back()
end
function cortarArvorePlantar()
if modo=="Y" then
comparar()
detectar()
voltar()
plantar()
else if modo=="N" then
comparar()
detectar()
voltar()
end
end
function cortarMover()
turtle.forward()
turtle.forward()
turtle.turnRight()
cortarArvore()
turtle.turnLeft()
end
function cortarCurva()
turtle.forward()
turtle.turnLeft()
turtle.forward()
turtle.turnRight()
cortarArvore()
turtle.turnLeft()
end
function cortarInicio()
turtle.forward()
turtle.turnRight()
cortarArvore()
turtle.turnLeft()
end
function restock()
turtle.turnRight()
turtle.turnRight()
turtle.suck()
turtle.turnRight()
turtle.turnRight()
end
function usarFuel()
while turtle.getFuelLevel()<=100 do
turtle.select(1)
turtle.refuel(5)
end
end
function depositar()
wood=turtle.getItemCount(1)
turtle.turnRight()
turtle.turnRight()
turtle.select(3)
repeat
turtle.drop(1)
until wood==1
end
turtle.turnRight()
turtle.turnRight()
end
function fim()
turtle.forward()
turtle.turnLeft()
turtle.select(1)
end
function cortarTudo()
usarFuel()
restock()
cortarInicio()
cortarMover()
cortarMover()
cortarMover()
cortarCurva()
cortarMover()
cortarMover()
cortarCurva()
cortarMover()
cortarMover()
cortarMover()
cortarCurva()
cortarMover()
cortarMover()
fim()
depositar()
end
cortarTudo()
Any Idea? :xxx