Guest User

sorter

a guest
Oct 13th, 2013
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.93 KB | None | 0 0
  1. local chest = peripheral.wrap("top")
  2. local input = peripheral.wrap("bottom")
  3. local disposal = peripheral.wrap("left")
  4. local serums = {}
  5. term.clear()
  6. term.setCursorPos(1,1)
  7. print("Serum Sorter v1.1 by apemanzilla")
  8. print("Reading data...")
  9. for i = 0, chest.getSizeInventory() - 1 do
  10.   local data = chest.getStackInSlot(i)
  11.   if data then
  12.     serums[data.name] = i
  13.   end
  14.   sleep(.05)
  15. end
  16. term.setCursorPos(1,1)
  17. term.clearLine()
  18. print("Waiting for serums!")
  19. while true do
  20.   for i = 0, input.getSizeInventory() - 1 do
  21.     local data = input.getStackInSlot(i)
  22.     if data then
  23.       if serums[data.name] then
  24.         --Move serum to furnace
  25.         input.push("up",i,1)
  26.         disposal.pull("south",0,1)
  27.         sleep(1)
  28.       else
  29.         --Move serum to chest
  30.         input.push("up",i,1)
  31.         chest.pull("down",0,1)
  32.         sleep(0.5)
  33.         write("Added: "..temp.name)
  34.         print()
  35.       end
  36.     end
  37.   end
  38. end
Advertisement
Add Comment
Please, Sign In to add comment