Valhalla Legends Archive

Programming => Battle.net Bot Development => Topic started by: BaDDBLooD on April 03, 2004, 05:32 PM

Title: Event: Flags_Change ( 0xF )
Post by: BaDDBLooD on April 03, 2004, 05:32 PM
Private Sub ChatBot_OnFlags(ByVal username As String, ByVal Flags As Long, ByVal message As String, ByVal Ping As Long)



Dim Bot As New clsBnetBot
   
   If (BNFLAGS_OP And Flags) = BNFLAGS_OP Then
       frmMain.lstChannel.ListItems.Remove frmMain.lstChannel.FindItem(username).Index
       With frmMain.lstChannel
           .ListItems.Add 1, , username, , Bot.GetIconCode(message, Flags)
           .ListItems(1).ListSubItems.Add , , , Bot.GetPingCode(Ping, Flags)
           .ListItems(1).ToolTipText = username & " [ " & Ping & " ms ] " & Flags & " Moderator"
       End With
       If BType.Joins = True Then
           AddChat vbGreen, username & " [ " & Ping & " ms ] " & Flags & " Flags Has acquired operator status."
       Else: End If
   End If
   
   For X = 1 To frmMain.lstChannel.ListItems.Count
       If frmMain.lstChannel.ListItems.Item(X).text = username Then
           With frmMain.lstChannel
               .ListItems.Item(X).SmallIcon = Bot.GetIconCode(message, Flags)
           End With
       End If
   Next X

End Sub



i tested this code, and when my War3 ops rejoined, i had 2 in the userlist, with no operator icon.

Any help would be apreciated, if you need further code.. just ask!

Note: the GetIconCode does work, because i can see the Names in the listview before this event fires!
Title: Re:Event: Flags_Change ( 0xF )
Post by: Newby on April 03, 2004, 05:39 PM
Check your OnUser sub. That may be the problem.
Title: Re:Event: Flags_Change ( 0xF )
Post by: BaDDBLooD on April 03, 2004, 05:43 PM


Private Sub ChatBot_OnUser(ByVal username As String, ByVal Flags As Long, ByVal message As String, ByVal Ping As Long)

Dim Bot As New clsBnetBot, ParsedString As String
   Call ParseStatString(message, ParsedString)

If Flags = "2" Then
   With frmMain.lstChannel
       .ListItems.Add 1, , username, , Bot.GetIconCode(message, Flags)
       .ListItems(1).ListSubItems.Add , , , Bot.GetPingCode(Ping, Flags)
       .ListItems(1).ToolTipText = username & " [ " & Ping & " ms ] " & Flags & " Moderator"
   End With
Else
   With frmMain.lstChannel
       .ListItems.Add , , username, , Bot.GetIconCode(message, Flags)
       .ListItems(.ListItems.Count).ListSubItems.Add , , , Bot.GetPingCode(Ping, Flags)
       .ListItems(.ListItems.Count).ToolTipText = ParsedString & " [ " & Ping & " ms ] " & Flags
   End With
End If

frmMain.txtChannelInfo = BType.CurrentChannel & " ( " & frmMain.lstChannel.ListItems.Count & " )"

End Sub



merry christmas to you all ;)

EDIT: i still need help ;)~
Title: Re:Event: Flags_Change ( 0xF )
Post by: Newby on April 03, 2004, 05:47 PM
Does that mean you fixed it? Or does that mean you still need help? :P
Title: Re:Event: Flags_Change ( 0xF )
Post by: effect on April 03, 2004, 06:00 PM
How about your write your own "GetIconCode" sub and dont use the public eth bot one. Just for starters...
Title: Re:Event: Flags_Change ( 0xF )
Post by: BaDDBLooD on April 03, 2004, 06:01 PM
i did make my own!
Title: Re:Event: Flags_Change ( 0xF )
Post by: effect on April 03, 2004, 06:05 PM
Icidentally you used the same naming convention as Ethbot , interesting. The icon's that arnt showing what product was/is the user on? have you loaded that image into your image list?
Title: Re:Event: Flags_Change ( 0xF )
Post by: BaDDBLooD on April 03, 2004, 06:12 PM
i can post my geticon code if you want me to

the icon is loaded in my image list, it's warcraft III, i will try it with Other icon's to see if it makes a difference ;O

EDIT: Nm no i can't my cdkey is in use =\
Title: Re:Event: Flags_Change ( 0xF )
Post by: ChR0NiC on April 03, 2004, 06:51 PM
Actually I believe BaDDBLooD is using a convention from either Dr Bot or Soup Bot which may have originally come from Eth.
Title: Re:Event: Flags_Change ( 0xF )
Post by: MyndFyre on April 03, 2004, 07:04 PM
Back to the topic, ahem...

The reason it's happenning is that Blizzard sends two events for a Warcraft 3 user, either gaining ops in a clan channel, changing the icon in the channel, getting the tag in a clan channel, or levelling in a clan channel.  They are EVENT_JOIN and then EVENT_SHOW.

You have to check your EVENT_SHOW (that is, the User event) to make it check your list to see if the user you are changing is already in the channel.  If so, update that user.  Otherwise, add it.
Title: Re:Event: Flags_Change ( 0xF )
Post by: FuzZ on April 03, 2004, 07:14 PM
I didn't read these posts, this is how I do mine.

Private Sub Event_Flags(strUser As String, strFlag As Long, strStatString As String, ping As Long)
   Dim p As String
   Dim N&
   If (strFlag And FLAGS_OP) = FLAGS_OP Then
       p = Trim$(StrReverse(Left$(strStatString, 4)))
       Select Case p
           Case CHAT: N = ICON_CHAT
           Case DRTL: N = ICON_DRTL
           Case DSHR: N = ICON_DSHR
           Case W2BN: N = ICON_W2BN
           Case STAR: N = ICON_STAR
           Case JSTR: N = ICON_JSTR
           Case SSHR: N = ICON_SSHR
           Case SEXP: N = ICON_SEXP
           Case D2DV: N = ICON_D2DV
           Case D2XP: N = ICON_D2XP
           Case WAR3: N = ICON_WAR3
           Case W3XP: N = ICON_W3XP
           Case Else: N = ICON_UNKNOWN
       End Select
   End If
   If (strFlag And FLAGS_OP) = FLAGS_OP Then: N = ICON_OP
   If (strFlag And FLAGS_BLIZZ) = FLAGS_BLIZZ Then: N = ICON_BLIZZ
   If (strFlag And FLAGS_SPKR) = FLAGS_SPKR Then: N = ICON_SPEAKER
   If (strFlag And FLAGS_SYSOP) = FLAGS_SYSOP Then: N = ICON_SYSOP
   If strUser <> BNet.CUser Then
       If (strFlag And FLAGS_SQUELCH) = FLAGS_SQUELCH Then: N = ICON_SQUELCH
   End If
   If (strFlag And FLAGS_GLASSES) = FLAGS_GLASSES Then: N = ICON_SPECTATOR
   If (strFlag And FLAGS_GFPLAYER) = FLAGS_GFPLAYER Then: N = ICON_GFP
   If N = ICON_UNKNOWN Then
       Open App.Path & "\Unknown.txt" For Append As #1
        Print #1, strUser & " " & strStatString & " " & strFlag & " " & ping
       Close #1
   End If
   If N = ICON_OP Then
       If LCase$(strUser) = LCase$(BNet.CUser) Then
           AddChat frmBNet.rtbChat, vbYellow, "You are now operator for this channel."
       Else
           AddChat frmBNet.rtbChat, vbYellow, strUser & " is now operator for this channel."
       End If
   End If
   EditNick strUser, N
   AddChat frmBNet.rtbChat, vbYellow, "User: " & strUser & " Flags: " & strFlag & " strStatString: " & statstring & " Ping: " & ping
End Sub


EditNick:

Public Sub EditNick(ByVal strName$, lngIcon&)
   With frmBNet.lstNicks
       Dim aIX
       aIX = .FindItem(strName).Index
       .ListItems(aIX).Icon = lngIcon
       .ListItems(aIX).SmallIcon = lngIcon
   End With
End Sub


these are based off from AssBot
Title: Re:Event: Flags_Change ( 0xF )
Post by: MyndFyre on April 04, 2004, 01:43 PM
Quote from: FuzZ on April 03, 2004, 07:14 PM
these are based off from AssBot

Does that mean you copied it?
Title: Re:Event: Flags_Change ( 0xF )
Post by: Eli_1 on April 04, 2004, 02:02 PM
Why are you all constantly accusing people of copying code...
Title: Re:Event: Flags_Change ( 0xF )
Post by: BaDDBLooD on April 04, 2004, 02:02 PM
Quote from: ChR0NiC on April 03, 2004, 06:51 PM
Actually I believe BaDDBLooD is using a convention from either Dr Bot or Soup Bot which may have originally come from Eth.

i wrote the code for every event, although i did not create the code for my 0xF.  Shadowed gave me the parsing into events function. ( Although i could right my own now that i am more advanced than i was )

admin, please delete posts like this.

edit: including this post

Title: Re:Event: Flags_Change ( 0xF )
Post by: Archangel on April 04, 2004, 02:06 PM
Quote from: BaDDBLooD on April 04, 2004, 02:02 PM
Quote from: ChR0NiC on April 03, 2004, 06:51 PM
Actually I believe BaDDBLooD is using a convention from either Dr Bot or Soup Bot which may have originally come from Eth.

i wrote the code for every event, although i did not create the code for my 0xF.  Shadowed gave me the parsing into events function. ( Although i could right my own now that i am more advanced than i was )

admin, please delete posts like this.

edit: including this post



Wow is just an opinion, i think people can give opinions about stuff, why would u want a admin to delete this post?
Title: Re:Event: Flags_Change ( 0xF )
Post by: BaDDBLooD on April 04, 2004, 02:30 PM
cause i am trying to get help, and as long as these posts exist;  They will sidetrack everyone from what the post is even about?
Title: Re:Event: Flags_Change ( 0xF )
Post by: MyndFyre on April 04, 2004, 04:18 PM
Did you read my reply?  I answered your question about how to handle the issue.
Title: Re:Event: Flags_Change ( 0xF )
Post by: BaDDBLooD on April 04, 2004, 04:43 PM
Quote from: Myndfyre on April 04, 2004, 04:18 PM
Did you read my reply?  I answered your question about how to handle the issue.

it happens on warcraft II as well.
Title: Re:Event: Flags_Change ( 0xF )
Post by: MyndFyre on April 04, 2004, 06:16 PM
Quote from: BaDDBLooD on April 04, 2004, 04:43 PM
Quote from: Myndfyre on April 04, 2004, 04:18 PM
Did you read my reply?  I answered your question about how to handle the issue.

it happens on warcraft II as well.

So have you tried to implement my solution?  If it happens the same way, then it should work on any game that it happens to you for.
Title: Re:Event: Flags_Change ( 0xF )
Post by: BaDDBLooD on April 04, 2004, 07:38 PM
no, i have not tried it yet