Advertisement
Guest User

Process.lua

a guest
Mar 18th, 2019
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.49 KB | None | 0 0
  1. local slots = {}
  2.  
  3. local total = 0
  4.  
  5. for i=2,16 do
  6.     local n = turtle.getItemCount(i)
  7.     if n > 0 then
  8.         total = total + n
  9.         table.insert(slots, {i=i, n=n})
  10.     end
  11. end
  12.  
  13. print("Found "..total.." items.")
  14.  
  15. for _,s in pairs(slots) do
  16.     turtle.select(s.i)
  17.    
  18.     for j=1,s.n do
  19.         if turtle.getFuelLevel() < 100 then
  20.             turtle.refuel(1)
  21.         end
  22.         turtle.place()
  23.         turtle.dig()
  24.     end
  25. end
  26.  
  27. print("Finished processing items!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement