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

Rednet Help

Started by koslas, 01 September 2012 - 05:42 AM
koslas #1
Posted 01 September 2012 - 07:42 AM
I am new to using rednet.

How would I make it show the rednet message only (not the computer ID aswell)

Also how would I make it receive it all the time and update automatically?

This will help me alot
Luanub #2
Posted 01 September 2012 - 07:45 AM
rednet will always send the ID, MSG, and distance there's no way to get around that without making your own program or modifying the original.

What are you trying to do with it? You can capture the output and only use the msg variable from it and not do anything with the id var.

What exactly are you wanting to update? More info is always better then less…

Example:

while true do
local id, msg = rednet.receive()
print(msg)
end
koslas #3
Posted 01 September 2012 - 07:51 AM
I am currently playing on a server with Factions plugin, and this is for a ally application

I am currently using

while true do
rednet.receive()
sleep(0)
end


This doesn't seem to be working though.
Any idea why not?

I am also using on the application computer

factionName = read()
–and also
reason = read()
–then
rednet.send(105, factionName)
rednet.send(105, reason)
– 105 is receiving computers ID

But it's not sending anything
Luanub #4
Posted 01 September 2012 - 07:55 AM
The sending portion should work. You're receiving code is not capturing the data received by rednet.receive(). You will want to capture it with vars like I did the in the small example I posted above.


local id, msg = rednet.receive() -- the computer id send will be captured in the var id, and the message in the var msg.

You can print the vars, check them in an if statement etc…

You can also name the vars anything you like.


local ignore, message = rednet.receive() -- or whatever you choose, use what makes the most sense to you.
koslas #5
Posted 01 September 2012 - 08:32 AM
Thank you for you help. This is now completed
I really liked it how you replied so quickly