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

Need help with red net

Started by CardingiSFun, 24 November 2012 - 05:54 AM
CardingiSFun #1
Posted 24 November 2012 - 06:54 AM
so im using 2 diffrent things on red net one for logging a bank system and the other for a irc chat.
but the bank system is picking up the irc chat. How do i prevent that?
Grim Reaper #2
Posted 24 November 2012 - 07:01 AM
You could have a ping system setup that would vary depending on which script you were running.

For example, the bank system's ping could send a message to the receiving computer: 'bankingPing'
To which the receiving computer would respond with something like: 'returningBankingPing', thus establishing a connection between the two in which the
banking system would just use rednet.send() to only transfer data specifically between the two computers.

The same goes for your IRC program. You could have the users ping the server; if they are excepted by the server, then they will use rednet.send() to send information back and forth between the computers.
remiX #3
Posted 24 November 2012 - 07:06 AM
Are you using rednet.broadcast()?
Dlcruz129 #4
Posted 24 November 2012 - 07:06 AM
Use rednet.send(id,msg), instead of rednet.broadcast().
CardingiSFun #5
Posted 24 November 2012 - 07:30 AM
i have to use rednet.broadcast() cause if i dont it wont host its own server and people wont connect the irc system can host multiple channels.
Kingdaro #6
Posted 24 November 2012 - 07:35 AM
Perhaps in the broadcast, you could input a specific type of parameter so that receiving programs will know that it's meant for them, and not whatever rednet programs you have operating?
remiX #7
Posted 24 November 2012 - 07:54 AM
Do what CardingiSFun said. Make the first letter of the broadcast for who must accept, like I for irc ones. So rednet.broadcast("I"..msg) and then the rest of the message. Then on the recieve end use
o = msg:sub(1,1)
if o = "I" then
 -- irc code
end
Then it will only do what ever you want if the first letter is I