Posted 26 December 2012 - 12:37 PM
I'm writing my first functioning quarry program. I got the turtle to travel to any coordinates i specify and it can dig a x by x hole of any size. Now i'm trying to make the turtle return to drop items or refuel if it needs to. I was trying to find out if there was a way to "pause" the loop then make the turtle refuel and stuff before making it return to the same spot and resume. Making the turtle resume where it left off would be much simpler then.
sorry about the sloppy code, I'm pretty new at this.
I found something about using this while loop on the internet but i can't get it to work. The turtle doesn't stop if its inventory is full or it's fuel gets too low.
sorry about the sloppy code, I'm pretty new at this.
I found something about using this while loop on the internet but i can't get it to work. The turtle doesn't stop if its inventory is full or it's fuel gets too low.
function quarryDig()
while true do
while turtle.getFuelLevel() < 70000 or turtle.getItemCount(16) ~= 0 do
returnItems()
end
for inty = 1, size do
for intx = 1, size - 1 do
forward()
end
row = row + 1
rowTurn = rowTurn + 1
if row < tonumber(size) then
if rowTurn >= 2 then rowTurn = 0 end
if rowTurn == 0 then
right()
forward()
right()
end
if rowTurn == 1 then
left()
forward()
left()
end
else
if rowTurn == 0 then
left()
row = 0
rowTurn = 0
else
right()
right()
row = 0
rowTurn = 0
end
end
end
end