Advertisement
Oeb25

Untitled

Sep 20th, 2014
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.77 KB | None | 0 0
  1. function wait(condition, compare, cb)
  2.     compare = compare == nill and true or compare
  3.  
  4.     while (condition ~= compare) do
  5.         if (cb) then
  6.             cb()
  7.         end
  8.         os.sleep(0.1)
  9.     end
  10.  
  11.     return true
  12. end
  13.  
  14. function fuel() {
  15.     local old = turtle.getSelectedSlot()
  16.  
  17.     while (turtle.getFuelLevel() < 10) do
  18.         turtle.select(16)
  19.         turtle.refuel()
  20.     end
  21.  
  22.     turtle.select(old)
  23. }
  24.  
  25. function forward(steps) {
  26.     fuel()
  27.     wait(turtle.forward)
  28.  
  29.     return true
  30. }
  31.  
  32. function up(steps) {
  33.     fuel()
  34.     wait(turtle.up)
  35.  
  36.     return true
  37. }
  38.  
  39. turtle.select(1)
  40. wait(turtle.compare)
  41. turtle.dig()
  42. forward()
  43.  
  44. function a()
  45.     turtle.digUp()
  46.     up()
  47. end
  48.  
  49. wait(turtle.detectUp, false, a)
  50.  
  51. wait(turtle.down, false)
  52.  
  53. turtle.turnRight()
  54. turtle.turnRight()
  55. forward()
  56. turtle.turnRight()
  57. turtle.turnRight()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement