IMarvinTPA

Automatic pickup

Dec 31st, 2012
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.99 KB | None | 0 0
  1. --pastebin get ertL1i4Y startup
  2.  
  3.  
  4. local function isFull()
  5.         local bFull = true
  6.         local nTotalItems = 0
  7.         for n=1,16 do
  8.                 local nCount = turtle.getItemCount(n)
  9.                 if nCount == 0 then
  10.                         bFull = false
  11.                 end
  12.                 nTotalItems = nTotalItems + nCount
  13.         end
  14.              
  15.         if bFull then
  16.                 print( "No empty slots left." )
  17.                 return true
  18.         end
  19.         return false
  20. end
  21.  
  22. local function unload()
  23.         print( "Unloading items..." )
  24.         --turtle.turnRight()
  25.         --turtle.turnRight()
  26.  
  27.         for n=1,16 do
  28.                 --unloaded = unloaded + turtle.getItemCount(n)
  29.                 turtle.select(n)
  30.                 turtle.dropUp()
  31.         end
  32.         --collected = 0
  33.         turtle.select(1)
  34.         --turtle.turnRight()
  35.         --turtle.turnRight()       
  36. end
  37.  
  38. print( "Picking Up..." )
  39.  
  40.  
  41. while true do
  42.     turtle.suck()
  43.     if isFull() then
  44.         unload()
  45.     end
  46.     sleep(5)
  47. end
Advertisement
Add Comment
Please, Sign In to add comment