Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- turtle.select(1) -- This uses the "Right Hand" rule, so don't expect it to always work
- print("Make sure to put a fuel source in slot 1")
- print("Press any key to continue...")
- sleep(0.1)
- os.pullEvent("char")
- function clr()
- term.clear()
- term.setCursorPos(1,1)
- end
- function refuel()
- if turtle.getFuelLevel() == 0 then
- if turtle.getItemCount() > 0 then
- turtle.refuel(1)
- return true
- else
- return false
- end
- else
- return true
- end
- end
- function move()
- turtle.turnRight()
- local count = 0
- while turtle.detect() do
- if count ~= 4 then
- turtle.turnLeft()
- count = count + 1
- else
- return false
- end
- end
- if turtle.forward() then
- return true
- else
- return false
- end
- end
- clr()
- print("Press ctrl+t to terminate the program.")
- while true do
- if refuel() then
- if not move() then
- break
- end
- else
- break
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment