Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- rednet listener --
- rednet.open("front") -- side of the modem
- m = peripheral.wrap("top") -- where the monitor is.
- widht, height = m.getSize()
- m.setTextScale(1) -- size of the text on screen
- msgAmount = height / m.getTextScale() -- the amount of messages displayed scale according to monitor size and text size, does not take into account size of string
- whitelist = {} -- ids to listen for
- messages = {} -- list of messages that are going to be displayed.
- ---------------------
- while true do
- event, id, msg, distance = os.pullEvent("rednet_message")
- for i = 1, #whitelist do
- if id == whitelist[i] then
- table.insert(messages, msg)
- end
- if #messages > msgAmount then
- table.remove(messages,1)
- end
- m.clear()
- for i = 1, #messages do
- m.setCursorPos(1,i)
- m.write(messages[i])
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement