2 posts
Posted 04 May 2015 - 10:53 AM
I've just started messing with ComputerCraft, I have a basic understanding of programming. I've managed to cobble together a script to monitor my Big Reactors, and I was wondering if there's a way I can have a computer on a platform, attached to a monitor, take information from another computer that's attached directly to the reactors/turbines and display that information on the display. I've been looking around, and there's probably something simple I'm missing, but would I have to re-code my entire program to accommodate the wireless setup? Or is there an easy way to take the information that would be written to a monitor and send it over to the receiving computer?
2679 posts
Location
You will never find me, muhahahahahaha
Posted 04 May 2015 - 09:55 PM
In order to achieve what you want you have to use two computers.
1st pc:
redent.open(side)
rednet.send(id,msg)
2nd pc:
local mon = peripheral.wrap(side)
rednet.open(side)
local id, msg = redent.receive()
mon.write(msg)
That is the basic code. Just embed it in your program, If you want to learn more about rednet, take a look at
this.
2 posts
Posted 06 May 2015 - 02:41 AM
Can I use this code to call my program from, say, startup? Or do I have to wrap my entire program in this and run it the same way I have been? I did read this code elsewhere, but I had gathered it was only for simple messages, not detecting peripherals wrapped on the client-side computer. If it actually IS capable of that, I'll be golden. Trying it when I get home
7083 posts
Location
Tasmania (AU)
Posted 06 May 2015 - 02:56 AM
Rednet does not directly allow you to pick up on peripherals attached to another computer. It does allow you to devise a system whereby one computer asks another for information about a peripheral, and the other sends information back. Creator's example is pseudo-code showing off the very basics.
If you want to access a peripheral remotely, the "simplest" way to do it is by connecting your computer to the peripheral using wired modems. Once you're all cabled up, use (right-click) the modem on the peripheral to "connect" it, which'll give you the name you should be using to "wrap" it.
If you specifically want to go wireless, stick with rednet. KoGY has an
example script you might be able to make use of.