Author Topic: TNet 3 - Send message to one single channel  (Read 2787 times)

xandeck

  • Jr. Member
  • **
  • Thank You
  • -Given: 1
  • -Receive: 3
  • Posts: 54
    • View Profile
TNet 3 - Send message to one single channel
« on: May 04, 2016, 07:27:23 PM »
Hello Aren,

Is there any way to send a message to a single channel/room?
Currently, I have a TNManager player who is inside at 3 channels at the same time. How can I send a message with "tno.Send" just to a specific channel?
If I send
  1. tno.Send("SomeMessage", Target.All, "my message");

Everyone that is in at least one of the channels/rooms will receive the message.
Thanks

xandeck

  • Jr. Member
  • **
  • Thank You
  • -Given: 1
  • -Receive: 3
  • Posts: 54
    • View Profile
Re: TNet 3 - Send message to one single channel
« Reply #1 on: May 04, 2016, 10:20:24 PM »
I was doing something wrong, nevermind.
But it could be good to know if this is true or not =)

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: TNet 3 - Send message to one single channel
« Reply #2 on: May 05, 2016, 05:01:14 PM »
You can specify a channel for tno.Send. Just check the function definitions. There's more than one. You still need to be in the channel before you can send, however.

xandeck

  • Jr. Member
  • **
  • Thank You
  • -Given: 1
  • -Receive: 3
  • Posts: 54
    • View Profile
Re: TNet 3 - Send message to one single channel
« Reply #3 on: May 05, 2016, 07:15:13 PM »
I did, I checked if there was a channel, but it was not specified (using version 3.0.1).
Or does the "byte rfcID" is the parameter? Target I think it is either the Target.something or the player...?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: TNet 3 - Send message to one single channel
« Reply #4 on: May 05, 2016, 07:36:31 PM »
I just double-checked. The TNObject.Send's channel ID comes from the TNObject itself. All objects belong to a channel. This is the channel that gets used for communication. You can transfer objects between channels as the multi-channel example shows that comes with TNet, but all RFCs always go to the object's channel.

xandeck

  • Jr. Member
  • **
  • Thank You
  • -Given: 1
  • -Receive: 3
  • Posts: 54
    • View Profile
Re: TNet 3 - Send message to one single channel
« Reply #5 on: May 05, 2016, 08:41:16 PM »
Nice, thank you for letting me know.
In any case, I already changed the way I did.