function MineTunnel()
print("Enter the length of the tunnel: ")
local a = io.read()
print("Name the tunnel: ")
local name = io.read()
a = tonumber(a)
local b = 0
while true do
turtle.digUp()
turtle.digDown()
turtle.down()
if turtle.detectDown() == false then
turtle.select(1)
turtle.placeDown()
else
end
turtle.up()
while true do
if turtle.detect(true) then
turtle.dig()
sleep(1)
else
break
end
end
turtle.forward()
b = b+1
if b >= a then
print("Tunnel "..name.." mined!")
rednet.open("right")
rednet.broadcast("ended mining tunnel "..name..".")
rednet.close("right")
break
else
end
end
end
I copied this code from my API text. Wrote it myself with the help of some tutorials and stuff











