Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local usedFuel = 0
- local usedTorches = 0
- function fuelChk()
- if turtle.getFuelLevel() < 20 then
- turtle.select(1)
- if turtle.refuel(1) == false then
- print("Out of fuel!")
- exit()
- end
- usedFuel = usedFuel + 1
- end
- end
- function doStuffAndThings()
- print("Thank you for using our amazing freaking program")
- print("Q009 says hello")
- print("Please specify the space interval")
- local space = io.read()
- space = tonumber(space)
- local t = space
- if space < 1 then space = 1 end
- while true do
- fuelChk()
- if turtle.getItemCount(2) == 0 then
- print("Out of torches!")
- exit()
- end
- while turtle.detect() do
- sleep(5)
- end
- if t == space then
- turtle.select(2)
- while turtle.detectDown() do
- sleep(1)
- end
- turtle.placeDown()
- t = 0
- else
- t = t + 1
- end
- turtle.forward()
- end
- print("Done! Used fuel: " .. usedFuel .. " | placed torches: " .. usedTorches)
- end
- doStuffAndThings()
Advertisement
Add Comment
Please, Sign In to add comment