Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- chest = peripheral.wrap("right")
- chestDir = "north"
- dumpItemsColor = 0xEEE --all red
- for k,v in pairs(chest) do
- print(k)
- end
- function setColor(i)
- if chest == nil then
- print(" :( ")
- end
- chest.setFrequency(i)
- end
- function getAllItems()
- for fromSlot = 1, chest.getInventorySize() do
- chest.pushItem(chestDir,fromSlot,64)
- end
- end
- function resetTurtle()
- getAllItems()
- setColor(dumpItemsColor)
- for fromSlot = 1, 16 do
- chest.pullItem(chestDir,fromSlot,64)
- end
- setColor(0)
- end
- function init()
- resetTurtle()
- end
- function waitForRecipeAndHandle()
- while true do
- setColor(0)
- items = chest.getAllStacks()
- os.sleep(1)
- if #items > 0 then
- chestNum = 1
- getAllItems()
- for fromSlot = 1,16 do
- ic = turtle.getItemCount(fromSlot)
- if ic > 0 then
- print(items[fromSlot].display_name)
- end
- for i = 1, ic do
- setColor(chestNum)
- chest.pullItem(chestDir, fromSlot, 1)
- chestNum = chestNum + 1
- os.sleep(0.05)
- end
- end
- end
- os.sleep(0.5)
- end
- end
- init()
- waitForRecipeAndHandle()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement