Advertisement
artem211

Tun1

Dec 30th, 2012
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.88 KB | None | 0 0
  1. x=0
  2. t=turtle
  3. function refuel(n)
  4.   if t.getFuelLevel() <=10 then
  5.     t.select(n)
  6.     t.refuel(1)
  7.   end
  8. end
  9. function fwd(st)
  10.   for i=1,st do
  11.     refuel(1)
  12.     while t.detect() do
  13.       while not(t.dig()) do
  14.         t.attack()
  15.         sleep(0.1)
  16.       end
  17.       sleep(0.2)
  18.     end
  19.     t.digDown()
  20.     while t.detectUp() do
  21.       while not(t.digUp()) do
  22.         t.attackUp()
  23.         sleep(0.1)
  24.       end
  25.     end
  26.    
  27.     if x>=7 then
  28.       t.select(2)
  29.       t.placeDown()
  30.       x=0
  31.     else
  32.       drop(3)
  33.     end
  34.     while not(t.forward()) do
  35.       t.attack()
  36.       sleep(0.1)
  37.       x=x-1
  38.     end
  39.     x=x+1    
  40.   end
  41. end
  42. function drop(sl)
  43.   if t.getItemCount(16) > 0 then
  44.     t.select(sl)
  45.     t.placeDown()
  46.     for i=4, 16 do
  47.       t.select(i)
  48.       t.dropDown()
  49.     end  
  50.     t.select(1)
  51.   end
  52. end
  53.  
  54. print('Length?')
  55. fwd(tonomber(read()))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement