rednet.open("right") local c = peripheral.wrap("bottom") local a = peripheral.wrap("front") local f = peripheral.wrap("left") local redstoneDir = "back" local crystals = {} function scanSlot(slot) c.pushItemIntoSlot("up", slot,1,1) turtle.drop() data = table.concat(a.getAspects()) crystals[data] = slot turtle.suck() c.pullItemIntoSlot("up", 1, 1,slot) end function scanSlots() redstone.setOutput(redstoneDir, true) for i = 1, 56 do if c.getStackInSlot(i) then scanSlot(i) end end redstone.setOutput(redstoneDir, false) end function essentia(aspect, numAspect) if not f.getStackInSlot(1) then c.pushItemIntoSlot("up", crystals[aspect], numAspect,1) f.pullItemIntoSlot("east", 1, numAspect,1) end while f.getStackInSlot(1) do print("Waiting for chest to empty...") sleep(3) end print("done") --   sleep(15) end function awaitRednet() local id, msg = rednet.receive() --  term.write(msg) local essData = {} essData = textutils.unserialize(msg) print(essData[1]..":"..essData[2]) essentia(essData[1], essData[2]) rednet.send(id, "Complete") end print("Scanning crystals...") scanSlots() print("Done scanning crystals!") while true do awaitRednet() end