Posted 13 January 2013 - 09:34 PM
i have maak a program for make a 3x3 tunnel.
only i cannot get a good gravel detect function for my program!
i want that the turtle detect gravel befor he forward en not mess up my count for the tunnel lengt.
and i.m not a good programmer.
and srry for my bad eng
only i cannot get a good gravel detect function for my program!
i want that the turtle detect gravel befor he forward en not mess up my count for the tunnel lengt.
and i.m not a good programmer.
and srry for my bad eng
n = 1
function dig()
dig1()
dig1()
dig1()
dig2()
end
function dig1()
turtle.dig()
turtle.turnRight()
turtle.forward()
turtle.turnLeft()
turtle.dig()
turtle.turnLeft()
turtle.forward()
turtle.forward()
turtle.turnRight()
turtle.dig()
turtle.turnRight()
turtle.forward()
turtle.turnLeft()
turtle.up()
end
function dig2()
turtle.down()
turtle.down()
turtle.forward()
end
function fuelCheck()
j = turtle.getFuelLevel()
turtle.getFuelLevel()
print("checking Fuel")
if j >180 then
print("Fuel is good")
else
print("Fuel is low! refueling")
turtle.select(1)
turtle.refuel(64)
end
end
function torch()
turtle.back()
turtle.up()
turtle.turnRight()
turtle.forward()
turtle.select(2)
turtle.placeUp()
turtle.back()
turtle.turnLeft()
turtle.down()
turtle.forward()
n = 1
end
print("fuel in slot1")
print("torch in slot2")
fuelCheck()
print("How far?")
dist = tonumber(read())
for i = 1, dist do
dig()
n = n + 1
if n == 7 then
torch()
end
end