This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
mpolder's profile picture

Print message when received

Started by mpolder, 19 December 2014 - 03:13 PM
mpolder #1
Posted 19 December 2014 - 04:13 PM
I have a modem that receives a message from another computer. How do i make the message appear on the terminal above the second computer?
ByteMe #2
Posted 19 December 2014 - 10:28 PM

while true do
  local msg = rednet.recieve()
    print(msg)

Not quite sure what you mean so theres a small snippet.
Bomb Bloke #3
Posted 19 December 2014 - 10:31 PM
"Above"? Do you mean on a monitor?
hbomb79 #4
Posted 19 December 2014 - 11:01 PM
If you mean on a monitor then you can do this:


mon = peripheral.wrap('top') --#Wrap monitor

for i, v in pairs(rs.getSides()) do
if peripheral.getType(v) == "modem" then
  rednet.open(v) --#Open rednet on any side that has a modem
end
end

local m, m1, m2 = rednet.receive() --#Wait for message
m = m or ""
mon.write(m) --#Display on monitor
print(m) --#Display on terminal
Edited on 19 December 2014 - 10:02 PM