Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local c=require("component")
- local modem=c.modem
- local pim=c.pim
- local io=require("io")
- local chestSide="east"
- local trashSide="south"
- local presentSide="west"
- local function presentPredicate(stack)
- --return stack.id=="OpenComputers:item" and stack.dmg==88 --1.7.10
- return stack.id=="OpenComputers:misc" and stack.dmg==2
- end
- local function trashPredicate(stack)
- --return stack.id=="OpenComputers:item" and stack.dmg==21 --1.7.10
- return stack.id=="OpenComputers:material" and stack.dmg==15
- end
- io.write("Command?\n")
- while true do
- io.write(">")
- local cmd = io.read()
- if cmd=="afk eject" then
- for i=1,pim.getInventorySize() do
- pim.pushItemIntoSlot(chestSide,i,64,i)
- end
- io.write("success!\n")
- elseif cmd=="afk pick up" then
- for i=1,pim.getInventorySize() do
- pim.pullItemIntoSlot(chestSide,i,64,i)
- end
- io.write("success!\n")
- elseif cmd=="start" then
- modem.broadcast(111,"")
- while true do
- for i=9,1,-1 do
- stack=pim.getStackInSlot(i)
- if stack and trashPredicate(stack) then
- pim.pushItem(trashSide,i,64)
- else
- break
- end
- end
- for i=1,9 do
- stack=pim.getStackInSlot(i)
- if stack and presentPredicate(stack) then
- pim.pushItem(presentSide,i,64)
- else
- break
- end
- end
- end
- elseif cmd=="exit" then
- return
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement