Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function fuelCheck()
- while turtle.getFuelLevel() < 1 do
- select(1)
- turtle.refuel()
- if turtle.getFuelLevel() < 1 then
- print("Out of fuel, refuel failed. Please put fuel in slot 1, then press enter to continue!")
- read()
- end
- end
- end
- function forward()
- fuelCheck()
- if not turtle.forward() then print("Forward Error! Fix issue and press enter to continue!") read() end
- end
- function back()
- fuelCheck()
- if not turtle.back() then print("Forward Error! Fix issue and press enter to continue!") read() end
- end
- index = 0
- while not turtle.detect() do
- forward()
- index = index + 1
- print(index)
- end
- for i=1,index do
- back()
- end
- print("Distance was: "..index.." blocks")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement