13 posts
Location
Denmark, Bornholm, 3730 Neksoe
Posted 18 April 2012 - 10:21 AM
HELLO! Im DonkeyzFTW an im a quite noob at computercraft… I need help with the rednet to controll my computer from another computer, if someone could help me with that :)/>/>
1111 posts
Location
Portland OR
Posted 18 April 2012 - 11:39 AM
First off read this so you kind of understand rednet
http://www.computercraft.info/forums2/index.php?/topic/244-13-how-to-use-modems-rednet/Next, using the rednet commands you will want to send a message to another computer and have that computer setup to where when it receives that message if performs a task.
Small example to turn a redstone signal on remotely.
Sending Computer:
rednet.open("side")
rednet.send(id, "redstoneOn")
Receiving Computer:
rednet.open("side")
id, msg = rednet.receive()
if msg == "redstoneOn" then
rs.setOutput("side", true)
end
Give it a shot, play around with it some and let us know when/if you run into problems with your code.
13 posts
Location
Denmark, Bornholm, 3730 Neksoe
Posted 18 April 2012 - 11:46 AM
Thank U :)/>/>
but dident work, i wrote:
39, msg = rednet.receive()
if msg == "OpenDoor" then
shell.run("open")
its the id number i think…
1111 posts
Location
Portland OR
Posted 18 April 2012 - 12:30 PM
Yeah you want to leave that id as just id.
id, msg = rednet.receive() –the var id in this command captures the first portion of the rednet message which is the senders id. So if you send a message from computer 1 saying "hello" and did the rednet.receive() on computer 2, id would == 1 and msg would == "hello".
rednet.send(id , "message") the id this command needs to be set to the computers id that you are sending the message to. so rednet.send(2, "hello")
378 posts
Location
In the TARDIS
Posted 18 April 2012 - 05:00 PM
id is a variable and you don't have to set it. Rednet will set it for you and it is the ID of the sending computer. You could write Peter or any other name instead of ID
13 posts
Location
Denmark, Bornholm, 3730 Neksoe
Posted 18 April 2012 - 06:13 PM
IT WORKED! THANKS TO U ALL!