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

some wireless modem help :3

Started by jstylez, 27 November 2012 - 01:43 AM
jstylez #1
Posted 27 November 2012 - 02:43 AM
Hi everyone,

This is my first post here at Computercraft forums, so if this post belongs somewhere else, or if there is some other problem with it, please tell me :)/>

Like the topic title says, I have some problems regarding the modems..
What I want to do, is create a server room, with a master sever, and 3 sub servers, 1 for password processing, one for redstone processing, and more of that.

I searched the internet, but I can't find something that totally explains how to, for example, send commands to another computer which has the modem enabled..

What I already have, is 1 master computer, and 2 sub computers with modems enabled at startup, and I also know the computer ids.

Thanks in advance :)/>
bjornir90 #2
Posted 27 November 2012 - 05:09 AM
To send commands throug rednet use this :

Sender side :

rednet.send(idOfReceiver, "nameOfTheProgram")

Receiver side :

id, msg = rednet.receive()
shell.run(msg)
remiX #3
Posted 27 November 2012 - 06:15 AM
Welcome the ComputerCraft forums :)/>

To send message over rednet is super easy:
rednet.send(id, "message") -- will send message only to the computer with id 'id'
rednet.broadcast("message") -- will send message to all computers/turtles that have a wireless model attached and on.

-- And then to receive it
sID, message, dist = rednet.receive()
print(message)
jstylez #4
Posted 27 November 2012 - 07:34 AM
Thanks alot for the help both of you :)/>
I will try this out, and see if I can get a little experienced with this :)/>
bjornir90 #5
Posted 27 November 2012 - 08:34 AM
And if you want to send a program that are not in the receiving computer, you could read the program file, send it with rednet and use loadstring("string") (). If you want an example, ask for it :)/>