Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local modem = peripheral.find("modem", rednet.open);
- local idFilename = "id"
- local protocol = "Potion_Brewer_SCANNER"
- local logging = "Potion_Brewer_LOGGER"
- local id = ""
- function log(string)
- print(string)
- rednet.broadcast("[SCANNER_"..id.."] "..string, logging)
- end
- function init()
- -- get this selectors id
- local idFile = fs.open(idFilename, "r")
- if idFile then
- id = idFile.readAll()
- idFile.close()
- else
- log("failed to open id file: "..idFilename)
- end
- log("ID file loaded, this selector is: "..id)
- rednet.host(protocol, id)
- --wait for an event to dispense the item
- while true do
- -- wait for a redstone event
- os.pullEvent("redstone")
- if rs.getInput("back") then
- -- send scanner event
- log("signal detected. broadcasting.")
- rednet.broadcast("EVENT_SCANNER_"..id, protocol)
- end
- end
- end
- init()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement