Posted 15 July 2013 - 06:11 PM
This mining turtle program should mine an area out, however I'm having a problem with one of the if statements, it should change x so the turtle alternates from turning left to turning right every 10 blocks it mines, but instead x stays at one so the turtle goes in circles.
local x = 1
for c = 1, 10, 1 do
print(x)
if x == 1 then
turtle.turnLeft()
turtle.dig()
turtle.forward()
turtle.digUp()
turtle.turnLeft()
end
if x == 2 then
turtle.turnRight()
turtle.dig()
turtle.forward()
turtle.digUp()
turtle.turnRight()
end
for x = 1, 10 , 1 do
turtle.dig()
turtle.forward()
turtle.digUp()
end
if x == 1 then
x = 2
end
if x == 2 then
x = 1
end
end
Edited by