Stravides

sugarcanes

Jul 26th, 2013
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.66 KB | None | 0 0
  1. write("Length: ")
  2. length = read()
  3. function moveForward(length)
  4.   for i = 1, length do
  5.         turtle.forward()
  6.   end
  7. end
  8. function switchLanes()
  9.   moveForward(1)
  10.   turtle.turnLeft()
  11.   moveForward(2)
  12.   turtle.turnLeft()
  13. end
  14. function dig()
  15.   turtle.dig()
  16.   moveForward(1)
  17.   turtle.digDown()
  18. end
  19. function roam()
  20.   for i = 1, length do
  21.  --       while turtle.getFuelLevel() <= 20 do
  22.  --         turtle.select(1)
  23.  --         turtle.refuel(1)
  24.  --       end
  25.         if turtle.detect() then
  26.           dig()
  27.         else
  28.          moveForward(1)
  29.         end
  30.   end
  31.   switchLanes()
  32.   sleep(60)
  33. end
  34.  
  35. turtle.up()
  36. turtle.up()
  37.  
  38. while true do
  39.   roam()
  40. end
Advertisement
Add Comment
Please, Sign In to add comment