iconmaster

bio-sorter

Jun 8th, 2013
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.65 KB | None | 0 0
  1. ids = {6,86,360,391,392,295,361,362,241,372,6.2}
  2. needed = {128,128,256,384,512,128,0,0,128,256,128}
  3. craft = {false,true,true}
  4. ae = peripheral.wrap("left")
  5.  
  6. while true do
  7.   pcall(function()
  8.     sleep(2)
  9.     print("Beigin check cycle...")
  10.     local list = ae.listItems()
  11.     for i=1,#ids do
  12.       n = list[ids[i]] or 0
  13.       print("found " .. n .. " of " .. ids[i] .. ".")
  14.       if n > needed[i] then
  15.         print("Sending "..(n-needed[i]))
  16.         ae.retrieve(ids[i],math.min(n-needed[i],16),3)
  17.         if craft[i] then turtle.craft() end
  18.         turtle.dropDown()
  19.         turtle.dropUp()
  20.       end
  21.       print("Done cycle.")
  22.     end
  23.   end)
  24. end
Advertisement
Add Comment
Please, Sign In to add comment