Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local ctrl = peripheral.wrap("bottom")
- function ParseMsg(id, msg)
- --if (id == 4) then
- if (msg == "Query_BYTES_TOTAL") then
- rednet.send(id, ctrl.getTotalBytes())
- end
- if (msg == "Query_BYTES_FREE") then
- rednet.send(id, ctrl.getFreeBytes())
- end
- if (msg == "Query_BYTES_USED") then
- rednet.send(id, ctrl.getUnusedBytes())
- end
- if (msg == "Query_SLOTS_TOTAL") then
- rednet.send(id, ctrl.getTotalItemTypes())
- end
- if (msg == "Query_SLOTS_FREE") then
- rednet.send(id, ctrl.getRemainingItemTypes())
- end
- if (msg == "Query_SLOTS_USED") then
- rednet.send(id, ctrl.getTotalItemTypes() - ctrl.getRemainingItemTypes())
- end
- --end
- end
- function ReceiveAsync()
- while true do
- id, msg, time = rednet.receive()
- print(msg)
- print(id)
- ParseMsg(id, msg)
- end
- end
- rednet.open("left")
- ReceiveAsync()
- rednet.close("left")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement