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

Control a computer with another computer

Started by WhitePhoenix0, 08 December 2013 - 11:15 AM
WhitePhoenix0 #1
Posted 08 December 2013 - 12:15 PM
So I mainly want to control a monitor from a distance away but I'll probably need another computer. In other words using modems or something I want to have a computer that controls a computer that controls a monitor. Oh Also I'm in tekkit classic (1.2.5)
mrpoopy345 #2
Posted 08 December 2013 - 12:37 PM
As of now, there is no way to send information directly to a monitor, so really what you will need is a computer controlling a computer controlling a computer controlling a modem.
Just as a base, I wrote you up a little program that will ask for an input and send it to another computer which will send it to another computer which will print it on a monitor.
Untested code:
Computer 1:

rednet.open("top") -- Opens a modem on the top of the computer
local input = read() --Ask for a user input
rednet.send(1, input) --Replace 1 with the 2nd computers ID
Second computer:

rednet.open("top")
id,message = rednet.receive() -- Waits for a message
rednet.send(2, message) --Replace 2 with the final computers ID
Final computer:

rednet.open("top")
id,message = rednet.receive()
mon = peripheral.wrap("back") -- Replace back with whatever side the monitor is on
mon.write(message)
Edited on 08 December 2013 - 11:38 AM
WhitePhoenix0 #3
Posted 08 December 2013 - 12:49 PM
Awesome thanks. I'm still learning computercraft. I've never used rednet before. I'll test it when I get back
Lyqyd #4
Posted 08 December 2013 - 01:00 PM
You don't need three computers, two will do just fine.
WhitePhoenix0 #5
Posted 08 December 2013 - 04:34 PM
Alrighty then what would I have to do differently?

It doesn't seem to send to computer number 2. I am only using 2. Only real difference I see is when you turn on computer 1, and then type something the first time it doesn't do anything.
mrpoopy345 #6
Posted 09 December 2013 - 08:09 AM
Lyqyd, I was implying that if the computers were too far away from each other computer number 1 would not be able to reach the monitor computer.
And to WhitePhoenix0, for only two, you would have to use the code from computer 1 and 3, not 1 and 2. Also, if the computers are too far away (16 blocks default I think.) They cannot receive messages. Also, remember to replace the ID's in my code with the ID's of the new computers.
WhitePhoenix0 #7
Posted 09 December 2013 - 10:03 AM
So that line I though did nothing, is what appears on the monitor. It only displays the text though, it doesn't run the program. Also it only works once.
mrpoopy345 #8
Posted 09 December 2013 - 12:01 PM
For it to work multiple time at the beggining of all of them put

while true do
Which will make an infinite loop.
What do you mean by run a program? What exactly do you want from this? Tell me what the program is.
WhitePhoenix0 #9
Posted 09 December 2013 - 06:16 PM
Like if I type worm nothing happens. I know you can't play it with the monitor but still… well I want to be able to do something other print text
Edited on 09 December 2013 - 05:28 PM
mrpoopy345 #10
Posted 10 December 2013 - 04:22 PM
If you want your monitor to mirror your computer, it is way more complicated use this:
http://www.computercraft.info/forums2/index.php?/topic/15873-mirror-utility-program-contents-of-computer-screen-on-monitor-v1/