Posted 23 February 2015 - 09:47 PM
args = {...}
length = args[1]
width = args[2]
depth = args[3]
WidthR = width-1
LengthR = length-2
function turtle.Advance(n)
for i=1,n do
turtle.dig()
turtle.forward()
end
end
function turtle.Left(n)
for i=1,n do
turtle.turnLeft()
turtle.dig()
turtle.forward()
end
end
function turtle.Right(n)
for i=1,n do
turtle.turnRight()
turtle.dig()
turtle.forward()
end
end
function turtle.Descend(n)
for i=1,n do
turtle.digDown()
turtle.down()
end
end
function turtle.Ascend(n)
for i=1,n do
turtle.digUp()
turtle.up()
end
end
ReTURNmine = width%2
for height=1,depth do
turtle.Advance(1)
for row=1,width do
if row~=width then
DeTURNmine = row%2
else
DeTURNmine = -1
end
turtle.Advance(LengthR)
if DeTURNmine==1 then
turtle.Left(2)
elseif DeTURNmine==0 then
turtle.Right(2)
end
end
if ReTURNmine==1 then
turtle.turnLeft()
for returnLength=1,length do
turtle.forward()
end
end
turtle.turnLeft()
for returnWidth=1,width do
turtle.forward()
end
turtle.turnLeft()
if height~=depth then
turtle.Descend(1)
end
end
The error occurs when the turtle gets to the final row (or column, however you see it) on a level. I tried to prevent the turtle from doing a turn on the final row, yet it still turns. Which then messes up the rest of the mining operation. Any guidance/explanation on how to fix this error (I would rather avoid having someone just give me a direct answer), thanks!