Advertisement
Guest User

startup

a guest
Dec 26th, 2014
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.33 KB | None | 0 0
  1. function go()
  2.   while not turtle.forward() do
  3.     os.sleep(0.3)
  4.   end
  5. end
  6. function goBack()
  7.   while not turtle.back() do
  8.     os.sleep(0.3)
  9.   end
  10. end
  11. function goUp()
  12.   while not turtle.up() do
  13.     os.sleep(0.3)
  14.   end
  15. end
  16. function goDown()
  17.   while not turtle.down() do
  18.     os.sleep(0.3)
  19.   end
  20. end
  21. function fuel()
  22.   while turtle.getFuelLevel() < 200 do
  23.     turtle.select(2)
  24.     turtle.suckDown(1)
  25.     turtle.refuel()
  26.   end
  27. end
  28.  
  29. fuel()
  30. turtle.select(16)
  31. if turtle.compareDown() then
  32.   if not turtle.detect() then
  33.     turtle.select(1)
  34.     turtle.drop()
  35.     go()
  36.     turtle.suck(1)
  37.     goBack()
  38.     turtle.place()
  39.   end
  40. else
  41.   turtle.up()
  42.   turtle.select(15)
  43.   if turtle.compareUp() then
  44.     turtle.select(1)
  45.     turtle.digUp()
  46.     goUp()
  47.     while turtle.compareUp() do
  48.       turtle.digUp()
  49.       goUp()
  50.     end
  51.   end
  52.   turtle.drop()
  53.   while not turtle.detectDown() do
  54.     goDown()
  55.   end
  56.   turtle.suck(1)
  57.   goBack()
  58.   turtle.place()
  59. end
  60.  
  61. while true do
  62.   os.sleep(10)
  63.   turtle.select(15)
  64.   if turtle.compare() then
  65.     fuel()
  66.     turtle.select(1)
  67.     turtle.dig()
  68.     go()
  69.     while turtle.compareUp() do
  70.       turtle.digUp()
  71.       goUp()
  72.     end
  73.     turtle.drop()
  74.     while not turtle.detectDown() do
  75.       goDown()
  76.     end
  77.     turtle.suck(1)
  78.     goBack()
  79.     turtle.place()
  80.   end
  81. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement