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

Rednet goes to wrong computer

Started by jargen, 09 April 2012 - 08:47 PM
jargen #1
Posted 09 April 2012 - 10:47 PM
I have 3 computers attached to each other using bundled cable, however when i send a message from computer 2 to computer 3, computer 1 and 3 get the message from computer 2. Even though rednet.send is set to send to computer 3. Cant work out why this is happening.
Luanub #2
Posted 09 April 2012 - 10:59 PM
Do you have code that we can look at? I don't have any issues like this in any of my programs.
jargen #3
Posted 09 April 2012 - 11:10 PM
Not sure how your supposed to show code other then screenshots so here goes:

Computer 1, ID 93 (end line cut off):

Computer 2, ID 88:


Computer 3, ID 91:

jargen #4
Posted 10 April 2012 - 08:37 PM
Or is this more of a bug?
Luanub #5
Posted 10 April 2012 - 09:43 PM
The only issue I see with just looking at the code is you never close the files you open. You add the following.


secret = file.readAll()
secret.close() -- add

Other then that I'm probably going to have to type out the code and try to duplicate your problem. You playing on a Server that don't have access to the file system? If your playing single player you can goto your .minecraft/saves/save_game/computer/computer_id folder and have access to your programs so you can copy and paste them.

Okay I see it. You have()'s if your if statement..


if(id == 91) then

if id == 91 then

You might have to convert id to a number to get it to work properly in the rest of the code as at this point it is a string. do


id = tonumber(id)
to convert it.
Edited on 10 April 2012 - 07:58 PM
jargen #6
Posted 11 April 2012 - 12:06 AM
The only issue I see with just looking at the code is you never close the files you open. You add the following.


secret = file.readAll()
secret.close() -- add

Other then that I'm probably going to have to type out the code and try to duplicate your problem. You playing on a Server that don't have access to the file system? If your playing single player you can goto your .minecraft/saves/save_game/computer/computer_id folder and have access to your programs so you can copy and paste them.

Okay I see it. You have()'s if your if statement..


if(id == 91) then

if id == 91 then

You might have to convert id to a number to get it to work properly in the rest of the code as at this point it is a string. do


id = tonumber(id)
to convert it.

The wrong computer still recieves the rednet signal even if i remove that if statement.
Luanub #7
Posted 11 April 2012 - 01:36 AM
Which computer is sending to the incorrect one? All of them? Are you sure you got the id's correct?
jargen #8
Posted 11 April 2012 - 03:06 AM
"when i send a message from computer 2 to computer 3, computer 1 and 3 get the message from computer 2. Even though rednet.send is set to send to computer 3"

And i listed the ID's on the pictures so you can see they are correct.
Luanub #9
Posted 11 April 2012 - 03:17 AM
It should work. I don't see anything wrong with the code. I'm at work now, will setup a test for this when I get home and see if I can duplicate it. With the way you have your rednet.send command setup it should send to just 91.

Do the other sends that you have setup work properly or do they send to extra/wrong computers as well?
jargen #10
Posted 11 April 2012 - 04:01 AM
It should work. I don't see anything wrong with the code. I'm at work now, will setup a test for this when I get home and see if I can duplicate it. With the way you have your rednet.send command setup it should send to just 91.

Do the other sends that you have setup work properly or do they send to extra/wrong computers as well?

I had a elevator system with like 11 computers in it which worked fine before (only 1 receiving though). Though i do remember having issues with some computers i tried to setup to message to each other on the same rednet line as the elevators.
Luanub #11
Posted 11 April 2012 - 04:04 AM
Ya I would expect to have some issues if sending both rs and rednet commands over the same cable.

It's probably best to use modems for rednet, they are faster and seem to work better.

I'll play around with it some when I get home tonight.
jargen #12
Posted 11 April 2012 - 04:06 AM
Ya I would expect to have some issues if sending both rs and rednet commands over the same cable.

It's probably best to use modems for rednet, they are faster and seem to work better.

I'll play around with it some when I get home tonight.

Modems range is awfull though.
Luanub #13
Posted 11 April 2012 - 04:08 AM
You can increase it in the cc config file.
jargen #14
Posted 11 April 2012 - 05:06 AM
Still be good to know why this problem is happening.

Ya I would expect to have some issues if sending both rs and rednet commands over the same cable.

No, seperate cables.
Luanub #15
Posted 11 April 2012 - 09:30 AM
So this appears to be a bug with the bundled cable. If I use bundled cables I can duplicate your error. If I use a modem the code works flawlessly.