Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local serverID = 58 -- change to the id of the computer that sends the message
- local sSide = "right" -- change to the side of the monitor
- local w = rednet.open("top")
- local mon = peripheral.wrap(sSide)
- if not mon then
- print("No monitor on ", sSide)
- return
- end
- local printcentred =
- function(text, line)
- local maxw, maxh = mon.getSize()
- local curx, cury = mon.getCursorPos()
- if line == nil then
- line = cury
- else
- cury = line
- end
- mon.setCursorPos((maxw-#text+3)/2,cury)
- mon.write(text)
- mon.setCursorPos(curx,cury+1)
- end
- function endswith(s, send)
- if s == nil or send == nil then return false end
- return #s >= #send and s:find(send, #s-#send+1, true) and true or false
- end
- term.redirect(mon)
- while true do
- local id, msg = rednet.receive()
- if id == serverID then
- if (endswith(msg, "at:")) then
- mon.clear()
- mon.setCursorPos(1, 3)
- else
- if (endswith(msg, "%")) then
- mon.setCursorPos(1, 4)
- else
- if (endswith(msg, "mated:") or endswith(msg, "ges...") or endswith(msg, " in:") or endswith "%.") then
- mon.setCursorPos(1,6)
- else
- mon.setCursorPos(1, 7)
- end
- end
- end
- printcentred(msg)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement