Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --!MissionControl
- --This is a program that effectively just receives and reports messages and displays them on a big screen
- monitor.clear()
- monitor.setCursorPos(1,1)
- monitor.write("This is the minion monitoring center,")
- monitor.setCursorPos(1,2)
- monitor.write("where we receive messages from minions and bases")
- i=4
- local w, h=monitor.getSize()
- while true do
- local event, modemSide, senderChannel,
- replyChannel, message, senderDistance = os.pullEvent("modem_message")
- if i>=h then
- monitor.clear()
- i=1
- end
- local l=string.len(message)
- local wi=w-22
- local wf=wi+1
- if senderChannel==128 then
- monitor.setCursorPos(1,i)
- if l>=wi then
- monitor.write("Message from Minion: "..string.sub(message,1,w))
- i=i+1
- monitor.setCursorPos(1,i)
- monitor.write(string.sub(message,wf))
- i=i+1
- else
- monitor.write("Message from Minion: "..message)
- i=i+1
- end
- elseif senderChannel==100 then
- monitor.setCursorPos(1,i)
- if l>=wi then
- monitor.write("Message from Base: "..string.sub(message,1,wi))
- i=i+1
- monitor.setCursorPos(1,i)
- monitor.write(string.sub(message,wf))
- i=i+1
- else
- monitor.write("Message from Base: "..message)
- i=i+1
- end
- else
- monitor.setCursorPos(1,i)
- if l>=wi then
- monitor.write("Message from Unknown: "..string.sub(message,1,wi))
- i=i+1
- monitor.setCursorPos(1,i)
- monitor.write(string.sub(message,wf))
- i=i+1
- else
- monitor.write("Message from Unknown: "..message)
- i=i+1
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment