Posted 15 June 2012 - 05:42 AM
So I can't seem to find the error here. I'm brand new to code but I think my logic is solid and its just a syntactical error. The program is supposed to dig a branch mine 2 blocks high, 41 blocks wide(20 to either side), and 10 branches long (40 blocks deep). The error returned is in my title. The program title is 'forward.' Any help would be appreciated.
local x, z = 0, 0
function forward2()
if turtle.forward() ==false then
repeat
turtle.dig()
sleep(0.25)
until turtle.forward() == true
end
if turtle.up() == false then
repeat
turtle.digUp()
sleep(0.25)
until turtle.up() == true
end
if turtle.forward() ==false then
repeat
turtle.dig()
sleep(0.25)
until turtle.forward() == true
end
turtle.digDown()
turtle.down()
end
if z < 10 then
forward2()
forward2()
turtle.turnLef()
repeat
forward2
x + 2
until x == 20
end
turtle.turnRight()
turtle.turnRight()
repeat
turtle.forward()
x - 1
until x == 0
end
repeat
forward2
x + 2
until x == 20
end
turtle.turnLeft()
turtle.turnLeft()
repeat
turtle.forward()
x - 1
until x == 0
end
turtle.turnRight()
z + 1
end
if z == 10 then
turtle.turnLeft()
turtle.turnLeft()
for i=1, 40 do
turtle.forward()
end