Advertisement
TTFTCUTS

Computercraft double box manager

Jul 12th, 2013
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.68 KB | None | 0 0
  1.  
  2. os.loadAPI("sortapi");
  3.  
  4. local sorter = { peripheral.wrap("left"), peripheral.wrap("back") };
  5. local chestdir = { sortapi.dir("west"), sortapi.dir("south") };
  6. local outdir = { sortapi.dir("east"), sortapi.dir("north") };
  7.  
  8. local limit = 5;
  9.  
  10. print("Double Box Manager v1.0");
  11. print("By TTFTCUTS");
  12.  
  13. while(true) do
  14.     if ( redstone.getInput("right") ) then
  15.         break;
  16.     end
  17.    
  18.     for i=1,2 do
  19.    
  20.         local box = sorter[i].list( chestdir[i] );
  21.         sleep(0.1);
  22.        
  23.         if box then
  24.        
  25.             for k,v in pairs(box) do
  26.                 if (v>limit) then
  27.                     sorter[i].extract( chestdir[i], k, outdir[i], v-limit );
  28.                 end
  29.                 sleep(0.05);
  30.             end    
  31.            
  32.             sleep(0.1);
  33.         end
  34.     end
  35.    
  36.     sleep(5);
  37. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement