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

Wireless monitor

Started by Thomas9666, 21 May 2012 - 06:55 PM
Thomas9666 #1
Posted 21 May 2012 - 08:55 PM
I am wondering, how do I set up a monitor to receive a wireless rednet signal and broadcast a message?
I want to set up a sign outside the main city of my server
MysticT #2
Posted 21 May 2012 - 11:34 PM
You need a computer that receives the messages and prints them on the monitor. Place a computer with the monitor(s) on any side, then make a program that receives the messages and prints them on the monitor. We can help you with the program, but you have to tell us how is it going to work (who can send messages to the monitor, how the messages will be printed, etc.), and we won't (at least I won't) make the program for you, you have to try to do your own programs, that's the idea of the mod.
Thomas9666 #3
Posted 22 May 2012 - 12:15 AM
Ok, I want it to run off of my own console in the city, the rest will not be able to access things like this. How do I send a message to a console so it runs a program? I tried it but it didn't work…
ok, but I don't really have any experience with the language…
MysticT #4
Posted 22 May 2012 - 12:23 AM
Ok, you would have to make the program wait for a message, and then check if it was sent from your computer (checking it's id) so only you can write on the monitor.
If The message will be the same always you just need to send some keyword that makes it display the message. It would be something like:
- receive a message
- check if the id is the server (the one who sends the messages)
- check if the message is the keyword
- if it is, display the message
- repeat everything

If you want to be able to send the text to show in the monitor you need some more work. You would have to create some command system that lets you clear the monitor, write text, etc.
Thomas9666 #5
Posted 22 May 2012 - 12:33 AM
How would I go about doing that?

Sorry, only got the mod today and only know about password doors :/
MysticT #6
Posted 22 May 2012 - 12:44 AM
Ok, here's a simple program that waits for a message to write some text on the monitor. It's not really usefull since it writes always the same and you can't clear it from the monitor, but it should help you get started.

local serverID = 0 -- change to the id of the computer that sends the message
local sSide = "back" -- change to the side of the monitor
local sKey = "WRITE_THE_TEXT" -- change to whatever you want the keyword message to be
local sText = "" -- write here the text you want on the monitor

local mon = peripheral.wrap(sSide)
if not mon then
  print("No monitor on ", sSide)
  return
end

term.redirect(mon)
while true do
  local id, msg = rednet.receive()
  if id == serverID then
    if msg == sKey then
	  term.clear()
	  term.setCursorPos(1, 1)
	  print(sText)
    end
  end
end
That's exactly what I said before translated to lua code.
Thomas9666 #7
Posted 22 May 2012 - 01:02 AM
ok, thanks… I'll try that out