Posted 27 June 2012 - 02:49 AM
I'm new to this so bare with me.
I'm trying to write a strip mining code so that the turtle digs a 1x2 tunnel 10 blocks deep and then turns around and comes back and dumps the items it mined. It works fine until there's a gap in the surface I'm mining. Now if the gap is an even number of blocks, the code works fine but if it's an odd numbered gap, then my turtle goes extra spaces for some reason. When it breaks the block before the gap, it'll skip breaking the block above and travel two spaces before taking variables into account again. I'm trying to test with 10 blocks but it goes 20 instead if there's nothing in front of it.
Any help is appreciated.
I'm trying to write a strip mining code so that the turtle digs a 1x2 tunnel 10 blocks deep and then turns around and comes back and dumps the items it mined. It works fine until there's a gap in the surface I'm mining. Now if the gap is an even number of blocks, the code works fine but if it's an odd numbered gap, then my turtle goes extra spaces for some reason. When it breaks the block before the gap, it'll skip breaking the block above and travel two spaces before taking variables into account again. I'm trying to test with 10 blocks but it goes 20 instead if there's nothing in front of it.
Any help is appreciated.
x,y,z=rednet.receive()
print(y)
if y=="go" then
b=0
c=0
if b<11 then
repeat
if turtle.detect()==false then
b=b+1
end
turtle.detect()
turtle.dig()
if turtle.forward()==true then
b=b+1
end
turtle.forward()
turtle.digUp()
sleep(.5)
if turtle.detectUp()==true then
repeat
turtle.digUp()
sleep(.5)
until turtle.detectUp==false()
end
until b>9
turtle.turnRight
turtle.turnRight
if c<10 then
repeat
if turtle.detect()==false then
c=c+1
end
turtle.forward()
until c>8
end
turtle.drop()
end
end