Posted 13 December 2012 - 12:32 PM
It maybe a bit ambitious but my first program on a mining turtle is supposed to dig a shaft in my branch mine, place torchs on the wall above it every 5 blocks, and then dig a second shaft back to hallway. I suspect there are some issues with my usage of modulous on torch placement, but I can't test it because on the line that calls my refueling function I keep getting an error '=' expected. That is line 24 in the code.
Local t = 0
function fuel()
if turtle.getFuelLevel() <= 10 then
turtle.refuel(1)
end
end
function shaft()
for l=1,21 do
while turtle.detect() == true do
turtle.dig()
sleep(.25)
end
while turtle.detectUp() == true do
turtle.digUp()
sleep(.25)
end
if t%5 == 0 then
turtle.select(16)
turtle.placeUp()
end
turtle.forward
fuel()
t = t + 1
end
end
shaft()
turtle.up()
turtle.turnLeft()
for n=1,3
while turtle.detect()
turtle.dig()
end
turtle.forward()
end
turtle.digDown()
turtle.down()
shaft()
Local t = 0
function fuel()
if turtle.getFuelLevel() <= 10 then
turtle.refuel(1)
end
end
function shaft()
for l=1,21 do
while turtle.detect() == true do
turtle.dig()
sleep(.25)
end
while turtle.detectUp() == true do
turtle.digUp()
sleep(.25)
end
if t%5 == 0 then
turtle.select(16)
turtle.placeUp()
end
turtle.forward
fuel()
t = t + 1
end
end
shaft()
turtle.up()
turtle.turnLeft()
for n=1,3
while turtle.detect()
turtle.dig()
end
turtle.forward()
end
turtle.digDown()
turtle.down()
shaft()