Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local args = {...}
- function accept()
- rs.setBundledOutput("back", colors.yellow)
- end
- function reject()
- rs.setBundledOutput("back", colors.red)
- end
- function load()
- rs.setBundledOutput("back", colors.blue)
- end
- function sortChestContents()
- return sensors.getReading("top", "Sensor")[0]
- end
- function loadNext()
- local contents = nil
- load()
- repeat
- contents = sortChestContents()
- os.sleep(1)
- until contents ~= nil
- end
- function select(name)
- while true do
- loadNext()
- local contents = sortChestContents()
- print("item detected: " .. contents)
- if string.find(contents, name) then
- -- sort chest contains sought item
- accept()
- return
- else
- -- sort chest doesn't contain sought item
- reject()
- end
- end
- end
- select(args[1])
Add Comment
Please, Sign In to add comment