Advertisement
HarvDad

b

Mar 14th, 2014
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. -- b
  2. -- Moves the turtle the specified distance backwards
  3. -- Written by HarvDad, March 2014
  4.  
  5. args = {...}
  6. nArgs = #args
  7.  
  8. x = 0
  9. y = 0
  10. z = 0
  11. face = 0
  12. minimumFuel = 100
  13. abort = false
  14. local currentFuelLevel = turtle.getFuelLevel()
  15. distance = 1;
  16.  
  17. if (nArgs == 1 and args[1]== "help") then
  18. print("Moves the turtle the specified distance backwards")
  19. print("Usage: f [distance]")
  20. return
  21. end
  22.  
  23. if nArgs == 1 then
  24. distance = tonumber(args[1])
  25. if distance == nil then
  26. print(args[1], " is not a valid distance")
  27. return
  28. end
  29. end
  30.  
  31. -- MAIN PROGRAM
  32.  
  33. turtle.select(1)
  34.  
  35. if currentFuelLevel ~= "unlimited" then
  36. if currentFuelLevel < minimumFuel then
  37. if not turtle.refuel() then
  38. print("No fuel")
  39. return
  40. end
  41. end
  42. end
  43.  
  44. for i=1,distance do
  45. turtle.back()
  46. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement