Bardiel

[ComputerCraft 1.45] Turtle Inventory Management v0.2

Oct 23rd, 2012
412
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.02 KB | None | 0 0
  1. --Power by Bardiel-- [email protected]
  2. --http://www.youtube.com/user/BardielHachiSan
  3.  
  4. --Este programa funciona con la vercion 1.45 del ComputerCraft
  5.  
  6. local tArgs = { ... }
  7.  
  8. if tonumber (tArgs[1]) then
  9.     slot = tonumber (tArgs[1])
  10. else
  11.     slot = -1
  12. end
  13.  
  14. for c = 1 , 15 do
  15.     if ( turtle.getItemCount( c ) > 0 ) and ( turtle.getItemSpace( c ) > 0 )then
  16.         turtle.select( c )
  17.         for t = c + 1 , 16 do
  18.             if turtle.compareTo( t ) and (turtle.getItemSpace( c ) > 0) then
  19.                 faltante = turtle.getItemSpace( c )
  20.                 turtle.select( t )
  21.                 turtle.transferTo(c, faltante)
  22.                 turtle.select( c )
  23.             end
  24.         end
  25.     end
  26. end
  27.  
  28. for c = 1 , 15 do
  29.     if turtle.getItemCount( c ) == 0 then
  30.         for t = c + 1 , 16 do
  31.             if turtle.getItemCount( t ) > 0 then
  32.                 turtle.select( t )
  33.                 turtle.transferTo(c, turtle.getItemCount( t ))
  34.                 turtle.select( c )
  35.             end
  36.         end
  37.     end
  38. end
  39.  
  40. if slot > 0 and slot < 17 then
  41.     turtle.select( slot )
  42. end
  43.  
  44. for c = 1 , 16 do
  45.     if turtle.getItemCount( c ) == 0 then
  46.         return true
  47.     end
  48. end
  49.  
  50. return false
Advertisement
Add Comment
Please, Sign In to add comment