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

Accessing Monitors through Rednet

Started by Pyrif, 18 June 2015 - 03:02 AM
Pyrif #1
Posted 18 June 2015 - 05:02 AM
I've checked the wiki numerous times, I've tried being creative (haha), nothing has worked. You can connect computers to other computers and disk drives and such through rednet, but how about monitors? Can somebody help me out here please?
Bomb Bloke #2
Posted 18 June 2015 - 05:14 AM
These code snippets may be what you're after.
Cranium #3
Posted 18 June 2015 - 05:48 AM
Peripherals like monitors can only be wrapped using wired modems or other computers. Either way, the peripheral has to be connected to a computer in some way, be that wired or directly touching.
Pyrif #4
Posted 18 June 2015 - 06:32 AM
That definitely helped, but how would I use this to find a specific monitor on rednet, such as monitor_0?
Bomb Bloke #5
Posted 18 June 2015 - 08:16 AM
Use rednet's lookup system. Have the computer with the monitor connected rednet.host() itself, using eg its label and eg a "RemoteMonitor" protocol. Once it's "hosting" it can still go on to do other things - it'll stay "hosted" pretty much until you reboot it.

Then have the computer doing the looking call rednet.lookup(), using the exact same label and protocol. That'll give you the ID number of the first system.

Note that, as Cranium points out, you can't "directly" access a monitor through rednet. There needs to be a computer connected to the display to act as a "proxy". This is because rednet itself is a protocol (for transmitting data through modem-based networks between computers only), and is implemented fully in Lua. The code snippets I gave you are an example of how you might transmit monitor-based instructions from one computer to another.

If you don't particularly care about using rednet, and more to the point, are happy to use network cables to connect your systems, then slap a wired modem on your monitor and computer, hook up the cables, right-click the monitor's modem to "connect" it, and have the computer wrap it using whatever name the resulting chat message tells you to use.

If you want to use wireless modems, the above isn't an option, so the code snippets I suggested earlier are probably the easiest way to go.
Creator #6
Posted 18 June 2015 - 12:46 PM
There is wireless peripherals by Yami.
Pyrif #7
Posted 18 June 2015 - 08:40 PM
Thanks for the help, guys! However, I seemed to have found an alternative method also requiring rednet cables:

local function mPerform(int,com)
    shell.run("monitor monitor_"..tostring(int).." "..com)
end