This is a read-only snapshot of the ComputerCraft forums,
taken in April 2020.
Rednet goes to wrong computer
Started by jargen, 09 April 2012 - 08:47 PMPosted 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.
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.
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:
Computer 1, ID 93 (end line cut off):
Computer 2, ID 88:
Computer 3, ID 91:
Posted 10 April 2012 - 08:37 PM
Or is this more of a bug?
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.
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..
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
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
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. doto convert it.id = tonumber(id)
The wrong computer still recieves the rednet signal even if i remove that if statement.
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?
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.
And i listed the ID's on the pictures so you can see they are correct.
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?
Do the other sends that you have setup work properly or do they send to extra/wrong computers as well?
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.
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.
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.
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.
Posted 11 April 2012 - 04:08 AM
You can increase it in the cc config file.
Posted 11 April 2012 - 05:06 AM
Still be good to know why this problem is happening.
No, seperate cables.
Ya I would expect to have some issues if sending both rs and rednet commands over the same cable.
No, seperate cables.
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.