Thanks for all the responses, I didn't think of the solution until after I posted this.
It was similar to BigSHinyToys' way. Except it sends the 300+ rednet messages and lags out when using 3+ receiving computers. None-the-less it works for what I need.
In the original code I looked for where it was calling the local monitor "peripheral.call(sSide,sMethod,…)"
local nativeTerm = term.native or term
local function invoke(sMethod, ...)
nativeTerm[sMethod](...)
for k,sSide in pairs(redstone.getSides()) do
if peripheral.isPresent(sSide) and peripheral.getType(sSide) == "monitor" then
--HERE
peripheral.call(sSide, sMethod, ...)
end
end
end
term.write = function(text) invoke("write", text) end
term.scroll = function(n) invoke("scroll", n) end
term.setCursorPos = function(x, y) invoke("setCursorPos", x, y) end
term.setCursorBlink = function() invoke("setCursorBlink")
term.clear = function() invoke("clear") end
term.clearLine = function() invoke("clearLine") end
nativeTerm.clear()
nativeTerm.setCursorPos(1, 1)
print(os.version())
Then I added
send = {sMethod,...}
encryptedSend = texutils.serialize(send)
rednet.broadcast(encryptedSend)
In the end the sending computer's code looked like this
local nativeTerm = term.native or term
local function invoke(sMethod, ...)
nativeTerm[sMethod](...)
for k,sSide in pairs(redstone.getSides()) do
if peripheral.isPresent(sSide) and peripheral.getType(sSide) == "monitor" then
peripheral.call(sSide, sMethod, ...)
send = {sMethod,...}
encryptedSend = textutils.serialize(send)
rednet.broadcast(encryptedSend)
end
end
end
term.write = function(text) invoke("write", text) end
term.scroll = function(n) invoke("scroll", n) end
term.setCursorPos = function(x, y) invoke("setCursorPos", x, y) end
term.setCursorBlink = function() invoke("setCursorBlink")
term.clear = function() invoke("clear") end
term.clearLine = function() invoke("clearLine") end
nativeTerm.clear()
nativeTerm.setCursorPos(1, 1)
print(os.version())
Receiving computer code:
side = "right"
m = peripheral.wrap(side)
m.setTextScale(.7)
rednet.open("left")
while true do
event, id, message = os.pullEvent("rednet_message")
unmessage = textutils.unserialize(message)
if #unmessage == 1 then
peripheral.call(side,unmessage[1])
elseif #unmessage == 2 then
peripheral.call(side,unmessage[1],unmessage[2])
elseif #unmessage == 3 then
peripheral.call(side,unmessage[1],unmessage[2],unmessage[3])
end
end
Which just gets the sent table, 'decodes' it, then checks for the amount of arguments which I send to the connected monitor.