Valhalla Legends Forums Archive | Battle.net Bot Development | Squelch Flags Update

AuthorMessageTime
Sonic
For some reason when I squelch somebody it doesn't assign them the icon; however, I have the same code for updating the users icon for ops updates and that works.

ID_Flags
[code]
If Flags = 30 Or Flags = 20 Then
On Error Resume Next
AddChat frmMain.rtbChannel, username & " has been squelched." & vbNewLine, vbYellow

frmMain.lvChannel.ListItems.Remove (frmMain.lvChannel.FindItem(username).Index)

frmMain.lvChannel.ListItems.Add , , username, , ICON_SQUELCH

frmMain.lvChannel.ListItems(frmMain.lvhannel.ListItems.Count).ListSubItems.Add , , ping

frmMain.lvChannel.ForeColor = vbWhite
End If
[/code]

Edit: Code format came out..weird, but looked good when I previewed
March 8, 2004, 9:10 PM
Eli_1
[quote author=Sonic link=board=17;threadid=5672;start=0#msg48386 date=1078780258]
For some reason when I squelch somebody it doesn't assign them the icon; however, I have the same code for updating the users icon for ops updates and that works.

ID_Flags
[code]
If Flags = 30 Or Flags = 20 Then
On Error Resume Next
AddChat frmMain.rtbChannel, username & " has been squelched." & vbNewLine, vbYellow

frmMain.lvChannel.ListItems.Remove (frmMain.lvChannel.FindItem(username).Index)

frmMain.lvChannel.ListItems.Add , , username, , ICON_SQUELCH

frmMain.lvChannel.ListItems(frmMain.lvhannel.ListItems.Count).ListSubItems.Add , , ping

frmMain.lvChannel.ForeColor = vbWhite
End If
[/code]

Edit: Code format came out..weird, but looked good when I previewed
[/quote]

I don't think 20 or 30 are correct, I think it's 32 or 34 or both...
March 8, 2004, 9:43 PM
PaiD
I use something like this

[code]
ElseIf (Flags And UF_SQUELCHED) = UF_SQUELCHED Then
frmMain.lwChannel.FindItem(User).SmallIcon = ICON_SQUELCH
frmMain.lwChannel.Refresh

Public Const UF_SQUELCHED = &H20

[/code]
March 8, 2004, 9:49 PM
Kp
heh. I just finished reading another thread about how you should use symbolic constants and use bitwise testing for flags. Your code does neither of these. A quick rewrite of the first part:[code]

' Assume these constants have been declared to the following values
' Squelched=&H20
' NoUDP=&H10
' Operator=2

if((Flags AND Squelched) <> 0)
' do something to show a squelched icon
' etc. with else-ifs for the other situations. Note the use of AND instead of equality.
[/code]

To address Eli_1's post, and to provide clarity as to why this failed: 20 and 30 are the correct values for squelched and squelched-no-udp if you write constants in hex. :) However, VB is interpreting those as decimal since you didn't specify otherwise.
March 8, 2004, 9:50 PM
PaiD
If I am correct you dont need to parse OnFlags for the NO UDP do you? I mean b/c you cant be on udp in a channel then change it in the channel without leaving, am I correct?

Edit: Spelling
March 8, 2004, 9:53 PM
Sonic
Alright fixed, I incorporated what Kp and Money said and combined them.

[code]
If ((Flags And BNFLAGS_SQUELCH) <> 0) Then
frmMain.lvChannel.FindItem(username).SmallIcon = ICON_SQUELCH
Dim u As Integer
For u = 1 To frmMain.lvChannel.ListItems.Count
If frmMain.lvChannel.ListItems(u).text = username Then
frmMain.lvChannel.ListItems(u).ForeColor = vbRed
End If
Next u
frmMain.lvChannel.Refresh

ElseIf ((Flags And BNFLAGS_OP) <> 0) Then
AddChat frmMain.rtbChannel, username & " has acquired operator status." & vbNewLine, vbYellow
frmMain.lvChannel.ListItems.Remove (frmMain.lvChannel.FindItem(username).Index)
frmMain.lvChannel.ListItems.Add 1, , username, , ICON_GAVEL
frmMain.lvChannel.ListItems(1).ListSubItems.Add , , ping

Else
frmMain.lvChannel.FindItem(username).SmallIcon = GetIcon(product, Flags, username)
Dim ut As Integer
For ut = 1 To frmMain.lvChannel.ListItems.Count
If frmMain.lvChannel.ListItems(ut).text = username Then
frmMain.lvChannel.ListItems(ut).ForeColor = vbWhite
End If
Next ut
frmMain.lvChannel.Refresh
End If
[/code]

Thanks to you both. :)
March 8, 2004, 10:18 PM
Kp
[quote author=MoNeY link=board=17;threadid=5672;start=0#msg48406 date=1078782836]If I am correct you dont need to parse OnFlags for the NO UDP do you? I mean b/c you cant be on udp in a channel then change it in the channel without leaving, am I correct?[/quote]

It's a bit hard to figure what you're asking, but if I understand the question, you are correct. A user cannot change his UDP-support status without reconnecting afaik (and if he can, that's a serious violation of how the real clients do it and could easily be detected by the server).

The only reason to consider the UDP flag in an OnFlags update routine is if you are testing for equality, since having the no-UDP flag does not prohibit you from acquiring other flags. However, as I and others have said several times, testing for equality is a bad idea when dealing with bitmasks. :)
March 8, 2004, 10:28 PM
PaiD
Ok thx for the response and yes that was the right question. Sorry for not making it more clear
March 8, 2004, 10:32 PM
Sonic
Are there any flags I should handle apart from Squelch/Op?
March 8, 2004, 10:43 PM
Kp
[quote author=Sonic link=board=17;threadid=5672;start=0#msg48424 date=1078785783]Are there any flags I should handle apart from Squelch/Op?[/quote]

You should probably detect Blizzard and SysOp class users, though I doubt you'll ever see a flags-change event for one of them.
March 8, 2004, 10:53 PM

Search