daily pastebin goal
65%
SHARE
TWEET

Untitled

a guest Mar 13th, 2018 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. args = {...}
  2. distance = args[1]
  3. currentDist = 0
  4. movingBack = false
  5. i = 0
  6.  
  7. turtle.refuel()
  8.  
  9. print("Fuel: " .. turtle.getFuelLevel())
  10. sleep(2)
  11. doMove(movingBack)
  12.  
  13. function doMove (back)
  14.     if back then
  15.         turtle.back()
  16.     end
  17.     if back == false then
  18.         turtle.dig()
  19.         turtle.forward()
  20.  
  21.     end
  22.     currentDist = currentDist + 1  
  23.  
  24.     i = i + 1
  25.     if i % 10 == 0 then
  26.         print("Fuel: " .. turtle.getFuelLevel())
  27.         i = 0
  28.     end
  29.  
  30.     if currentDist == distance then
  31.         if movingBack == false then
  32.             currentDist = 0
  33.             movingBack = true
  34.         end
  35.         if movingBack == true then
  36.             return
  37.         end
  38.     end
  39.     if currentDist < distance then
  40.         doMove(movingBack)
  41.     end
  42.  
  43. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top