Spoiler
rednet.open("top")
term.clear()
term.setCursorPos(1,4)
function send()
oldx, oldy = term.getCursorPos()
term.setCursorPos(1,19)
input = read()
rednet.broadcast(input)
term.setCursorPos(1,18)
term.clearLine()
term.setCursorPos(oldx,oldy)
end
function top()
oldx, oldy = term.getCursorPos()
term.setCursorPos(1,1)
term.clearLine()
term.setCursorPos(1,2)
term.clearLine()
term.setCursorPos(1,3)
term.clearLine()
term.setCursorPos(1,1)
print("Rednet Broadcast Receiver Press \"S\" to Send")
print("Monitering All Rednet Since Day 316.")
print("Format: \"day | time | message | id\"")
print("===================================================")
term.setCursorPos(1,19)
term.clearLine()
term.setCursorPos(oldx,oldy)
end
while true do
term.setTextColor(colors.white)
top()
term.setTextColor(colors.blue)
event, param1, param2, param3 = os.pullEvent()
if event == "rednet_message" then
local day = os.day()
local time = textutils.formatTime(os.time(), true)
printing = day.." | "..time.." | \""..param2.."\" | "..param1
print(printing)
end
if event == "char" and param1 == "s" then
send()
end
end
The top() function just keeps the top text always there, send() is self-explanatory.
Any help is appreciated. Thanks! :)/>