Advertisement
Guest User

startup

a guest
Feb 23rd, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.66 KB | None | 0 0
  1. local cut = 0
  2. while true do
  3.   turtle.suck()
  4.   turtle.turnRight()
  5.   local ok,block = turtle.inspect()
  6.   if ok and block and block.name:match("log") then
  7.     turtle.select(2)
  8.     turtle.dig()
  9.     turtle.forward()
  10.     while turtle.detectUp() do
  11.       turtle.digUp()
  12.       if turtle.getFuelLevel()<900 then
  13.         turtle.refuel()
  14.       end
  15.       turtle.up()
  16.     end
  17.     while turtle.down() do
  18.     end
  19.     turtle.back()
  20.    
  21.     for i = 1, 16 do
  22.       local item = turtle.getItemDetail(i)
  23.       if item and not item.name:match("sapling") then
  24.         turtle.select(i)
  25.         turtle.dropUp()
  26.       end
  27.     end
  28.     --[[turtle.select(1)
  29.     turtle.place()]]
  30.     if cut == 0 then
  31.       cut = 180
  32.     end
  33.   elseif not ok then
  34.     turtle.select(1)
  35.     local item = turtle.getItemDetail()
  36.     if item and item.name:match("sapling") then
  37.       turtle.place()
  38.     else
  39.       for i = 1, 16 do
  40.         turtle.select(i)
  41.         local item = turtle.getItemDetail()
  42.         if item and item.name:match("sapling") then
  43.           turtle.transferTo(1)
  44.           turtle.select(1)
  45.           turtle.place()
  46.           break
  47.         end
  48.       end
  49.     end
  50.   end
  51.   if cut > 0 and turtle.getItemCount(1) < 32 then
  52.     cut = cut-1
  53.     if cut == 0 then
  54.       turtle.down()
  55.       turtle.suckDown()
  56.       turtle.up()
  57.     end
  58.     if cut%20==0 then
  59.       print(cut)  
  60.     end
  61.   end
  62. --[[  if turtle.getFuelLevel() < 1000 then
  63.     turtle.select(2)
  64.     turtle.suckUp()
  65.     turtle.select(1)
  66.     turtle.dropUp()
  67.     turtle.craft()
  68.     for i = 1, 16 do
  69.       turtle.select(i)
  70.       turtle.refuel()
  71.     end
  72.     turtle.select(1)
  73.     turtle.suckUp()
  74.   end ]]
  75. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement