Advertisement
Guest User

startup

a guest
Feb 24th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.73 KB | None | 0 0
  1. local cut = 0
  2.  
  3. while true do
  4.  
  5.   turtle.suck()
  6.  
  7.   turtle.turnRight()
  8.  
  9.   local ok,block = turtle.inspect()
  10.  
  11.   if ok and block and block.name:match("log") then
  12.  
  13.     turtle.select(2)
  14.  
  15.     turtle.dig()
  16.  
  17.     turtle.forward()
  18.  
  19.     while turtle.detectUp() do
  20.  
  21.       turtle.digUp()
  22.  
  23.       if turtle.getFuelLevel()<900 then
  24.  
  25.         turtle.refuel()
  26.  
  27.       end
  28.  
  29.       turtle.up()
  30.  
  31.     end
  32.  
  33.     while turtle.down() do
  34.  
  35.     end
  36.  
  37.     turtle.back()
  38.  
  39.    
  40.  
  41.     for i = 1, 16 do
  42.  
  43.       local item = turtle.getItemDetail(i)
  44.  
  45.       if item and not item.name:match("sapling") then
  46.  
  47.         turtle.select(i)
  48.  
  49.         turtle.dropUp()
  50.  
  51.       end
  52.  
  53.     end
  54.  
  55.     --[[turtle.select(1)
  56.  
  57.     turtle.place()]]
  58.  
  59.     if cut == 0 then
  60.  
  61.       cut = 180
  62.  
  63.     end
  64.  
  65.   elseif not ok then
  66.  
  67.     turtle.select(1)
  68.  
  69.     local item = turtle.getItemDetail()
  70.  
  71.     if item and item.name:match("sapling") then
  72.  
  73.       turtle.place()
  74.  
  75.     else
  76.  
  77.       for i = 1, 16 do
  78.  
  79.         turtle.select(i)
  80.  
  81.         local item = turtle.getItemDetail()
  82.  
  83.         if item and item.name:match("sapling") then
  84.  
  85.           turtle.transferTo(1)
  86.  
  87.           turtle.select(1)
  88.  
  89.           turtle.place()
  90.  
  91.           break
  92.  
  93.         end
  94.  
  95.       end
  96.  
  97.     end
  98.  
  99.   end
  100.  
  101.   if cut > 0 and turtle.getItemCount(1) < 32 then
  102.  
  103.     cut = cut-1
  104.  
  105.     if cut == 0 then
  106.  
  107.       turtle.down()
  108.  
  109.       turtle.suckDown()
  110.  
  111.       turtle.up()
  112.  
  113.     end
  114.  
  115.     if cut%20==0 then
  116.  
  117.       print(cut)  
  118.  
  119.     end
  120.  
  121.   end
  122.  
  123. --[[  if turtle.getFuelLevel() < 1000 then
  124.  
  125.     turtle.select(2)
  126.  
  127.     turtle.suckUp()
  128.  
  129.     turtle.select(1)
  130.  
  131.     turtle.dropUp()
  132.  
  133.     turtle.craft()
  134.  
  135.     for i = 1, 16 do
  136.  
  137.       turtle.select(i)
  138.  
  139.       turtle.refuel()
  140.  
  141.     end
  142.  
  143.     turtle.select(1)
  144.  
  145.     turtle.suckUp()
  146.  
  147.   end ]]
  148.  
  149. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement