Valhalla Legends Forums Archive | Battle.net Bot Development | SID_GETCHANNELLIST Question

AuthorMessageTime
BaDDBLooD
Is there a Constant Number of Channels for ALL Clients?
August 25, 2004, 1:53 AM
K
Probably not. If your question is because you're wondering how to parse it, you just need to keep reading strings out of your packet until you find a double null, since the channel list is terminated by a double null.

[code]
psuedocode
OnGetChannelList(BncsPacket p)
{
list<string> channels;
string current_channel;

while(p.PeekWord() != 0)
{
current_channel = p.ReadString();
channels.add(current_channel);
}
}
[/code]
August 25, 2004, 2:09 AM
Spht
[quote author=BaDDBLooD link=board=17;threadid=8359;start=0#msg77236 date=1093398795]
Is there a Constant Number of Channels for ALL Clients?
[/quote]

No. I assume you're asking this because you don't know how to grab each channel name in a SID_GETCHANNELLIST response?

Each channel is null-terminated. To handle this in VB it's easy. Let's say s is your data (not including the header):

[code]Dim a As Long, b
b = Split(s, vbNullChar)
For a = LBound(b) To UBound(b) - 1 ' ignore last empty null
' b(a) is the next channel
Next a[/code]

That is simply splitting the data by each null so you can read channel. That is one way which is probably the easiest to explain/understand. Others can post other methods if they so desire.
August 25, 2004, 2:16 AM
BaDDBLooD
I was wondering how i am going to add these into a Menu.

EDIT: I already have the code to parse 0x0B, thanks though.
August 25, 2004, 2:16 AM
Myndfyr
[quote author=BaDDBLooD link=board=17;threadid=8359;start=0#msg77240 date=1093400211]
I was wondering how i am going to add these into a Menu.

EDIT: I already have the code to parse 0x0B, thanks though.
[/quote]

I know you're using .NET. Here's some pseudo-code:

You have the menu (such as Channels) you want -- since the Channels menu is of type MenuItem, let's call it miChannels.

[code]
For Each s As String in ListOfChannels
' Create new MenuItem using constructor
' Set the MenuItem.Click event handler on that item instance.
miChannels.MenuItems.Add(myNewMenuItem)
Next
[/code]
August 25, 2004, 2:20 AM
BaDDBLooD
Except for.. i'm not using .NET Cause i could never get my .NET Bot to work! Yeah, that's right!

EDIT: I am using VB6, i WISH I Could use .NET
August 25, 2004, 2:22 AM
Spht
[quote author=BaDDBLooD link=board=17;threadid=8359;start=0#msg77240 date=1093400211]
I was wondering how i am going to add these into a Menu.

EDIT: I already have the code to parse 0x0B, thanks though.
[/quote]

Then you asked your question VERY badly. Maybe start a thread in the "X Programming forum" for "Adding items to a menu"?
August 25, 2004, 2:23 AM
BaDDBLooD
My original topic was is the number of channels static, it got off topic.
August 25, 2004, 2:24 AM

Search