Obviously, this requires a script on the other end listening for these packets and acting appropriately. There is a working example in LyqydNet, but obviously, the rednet operations are greatly simplified since it's dependent on LyqydNet. Here are the relevant portions of LyqydNet:
Spoiler
function text (conn)
local textTable = {}
textTable.conn = conn
textTable.write = function(text)
return connection.send(textTable.conn, "textWrite", text)
end
textTable.clear = function()
return connection.send(textTable.conn, "textClear", "nil")
end
textTable.clearLine = function()
return connection.send(textTable.conn, "textClearLine", "nil")
end
textTable.getCursorPos = function()
if connection.send(textTable.conn, "textGetCursorPos", "nil") then
local pType, message = connection.awaitResponse(textTable.conn, 2)
if pType and pType == "textInfo" then
local x, y = string.match(message, "(%d+),(%d+)")
return tonumber(x), tonumber(y)
end
else return false end
end
textTable.setCursorPos = function(x, y)
return connection.send(textTable.conn, "textCursorPos", math.floor(x)..","..math.floor(y))
end
textTable.setCursorBlink = function(:P/>/>
if b then
return connection.send(textTable.conn, "textBlink", "true")
else
return connection.send(textTable.conn, "textBlink", "false")
end
end
textTable.getSize = function()
if connection.send(textTable.conn, "textGetSize", "nil") then
local pType, message = connection.awaitResponse(textTable.conn, 2)
if pType and pType == "textInfo" then
local x, y = string.match(message, "(%d+),(%d+)")
return tonumber(x), tonumber(y)
end
else return false end
end
textTable.scroll = function(lines)
return connection.send(textTable.conn, "textScroll", lines)
end
return textTable
end
function processText(conn, pType, value)
if not pType then return false end
if pType == "textWrite" and value then
term.write(value)
elseif pType == "textClear" then
term.clear()
elseif pType == "textClearLine" then
term.clearLine()
elseif pType == "textGetCursorPos" then
local x, y = term.getCursorPos()
connection.send(conn, "textInfo", math.floor(x)..","..math.floor(y))
elseif pType == "textCursorPos" then
local x, y = string.match(value, "(%d+),(%d+)")
term.setCursorPos(x, y)
elseif pType == "textBlink" then
if value == "true" then
term.setCursorBlink(true)
else
term.setCursorBlink(false)
end
elseif pType == "textGetSize" then
x, y = term.getSize()
connection.send(conn, "textInfo", x..","..y)
elseif pType == "textScroll" and value then
term.scroll(value)
end
return
end