Valhalla Legends Forums Archive | Battle.net Bot Development | If statement help

AuthorMessageTime
blinkdude
My if statement is wrong i know :/ i trying to see who has flags "2" in the channel and gives them the "OP" icon
[code]
Private Sub CleanSlateBot1_UserInChannel(ByVal Username As String, ByVal Flags As Long, ByVal Message As String, ByVal Ping As Long, ByVal Product As String, StatUpdate As Boolean, SimulatedEvent As Boolean)

Dim MyItem As ListItem
Set MyItem = ListView1.ListItems.Add()

If Username(Flags) = 2 Then
MyItem.SmallIcon = 1

MyItem.Text = Username
MyItem.SubItems(1) = Ping & " ms"
Else
Select Case Product
Case "WAR3": MyItem.SmallIcon = 13
Case "D2DV": MyItem.SmallIcon = 12
Case "STAR": MyItem.SmallIcon = 8
Case "D2XP": MyItem.SmallIcon = 12
Case "SEXP": MyItem.SmallIcon = 11
Case "W2BN": MyItem.SmallIcon = 9
Case "TAHC": MyItem.SmallIcon = 10
Case "W3XP": MyItem.SmallIcon = 10
End Select
MyItem.Text = Username
MyItem.SubItems(1) = Ping & " ms"


End If
End Sub
[/code]
July 15, 2003, 5:24 AM
blinkdude
n/m i got it :/
[code]
Private Sub CleanSlateBot1_UserInChannel(ByVal Username As String, ByVal flags As Long, ByVal Message As String, ByVal Ping As Long, ByVal Product As String, StatUpdate As Boolean, SimulatedEvent As Boolean)

Dim MyItem As ListItem
Set MyItem = ListView1.ListItems.Add()
If LCase(flags) = 2 Then
MyItem.SmallIcon = 1

MyItem.Text = Username
MyItem.SubItems(1) = Ping & " ms"
Else
Select Case Product
Case "WAR3": MyItem.SmallIcon = 13
Case "D2DV": MyItem.SmallIcon = 12
Case "STAR": MyItem.SmallIcon = 8
Case "D2XP": MyItem.SmallIcon = 12
Case "SEXP": MyItem.SmallIcon = 11
Case "W2BN": MyItem.SmallIcon = 9
Case "TAHC": MyItem.SmallIcon = 10
Case "W3XP": MyItem.SmallIcon = 10
End Select
MyItem.Text = Username
MyItem.SubItems(1) = Ping & " ms"

End If

End Sub
[/code]
July 15, 2003, 5:30 AM
Soul Taker
Why are you lcasing() a long?
Also, remove the two instances of
[code]
MyItem.Text = Username
MyItem.SubItems(1) = Ping & " ms"
[/code]
and put it once outside the if statement.
And I strongly urge you use a bitwise comparison to determine the icon from flags.
July 15, 2003, 5:42 AM
blinkdude
yes it takes a while to ban and my code is sloopy but it works :/ ... ip banning is so fun... :)
July 15, 2003, 5:45 AM
Soul Taker
If you don't use a bitwise comparison, someone without UDP support will be able to dodge your IP bans.
July 15, 2003, 5:47 AM

Search