Valhalla Legends Forums Archive | Battle.net Bot Development | Two diff events firing at the same time

AuthorMessageTime
FLiPPY_
Ok.. so when a user joins the channel and the bot is loaded.. it adds the username twice to the list.. and when they leave.. it only removes one.. The events
Private Const ID_USER = &H1
Private Const ID_JOIN = &H2
Must be firing at the same time..
When a user is in the channel it adds it twice also
[code]
Public Sub Event_User(strUser, strFlag, strProduct, Ping)
On Error Resume Next
Dim itmX As ListItem
Dim clmX As ColumnHeader
Dim intItem As Integer

frmChat.lvChannel.View = lvwReport
Set clmX = frmChat.lvChannel.ColumnHeaders.Add(, , "test")
For intItem = 0 To 1
Set itmX = frmChat.lvChannel.ListItems.Add(, , CStr(strUser))
Next
AddSpeech vbGreen, "User " & strUser & " is in the channel using " & strProduct & "."
End Sub

Public Sub Event_Join(strUser, strFlag, strProduct, Ping)
On Error Resume Next
Dim myFlag As String
Dim intAccess As Integer, Icon As Integer, strFlagLock As String, boolSL As Boolean

AddSpeech vbGreen, "User " & strUser & " has joined " & TheChannel & " using " & strProduct & "."

Dim itmX As ListItem
Dim clmX As ColumnHeader
Dim intItem As Integer

frmChat.lvChannel.View = lvwReport
Set clmX = frmChat.lvChannel.ColumnHeaders.Add(, , "test")
For intItem = 0 To 1
Set itmX = frmChat.lvChannel.ListItems.Add(, , CStr(strUser))
Next
End Sub
[/code]
I dont think if you need this part.. probably not but here it is anyways
[code]
Case ID_USER
Event_User strUser, Flags, "[" & StrReverse(Left(Message, 4)) & "]", Ping
Case ID_JOIN
Event_Join strUser, Flags, "[" & StrReverse(Left(Message, 4)) & "]", Ping
[/code]
October 6, 2003, 11:38 PM
Freeware
... :o :o :o

[code]
For intItem = 0 To 1
Set itmX = frmChat.lvChannel.ListItems.Add(, , CStr(strUser))
Next
[/code]

Ok thats your problem right there, I dunno why you are adding the Item twice with a For statement, change it to this:

[code]
Set itmX = frmChat.lvChannel.ListItems.Add(, , CStr(strUser))
[/code]

Change that code from both Subroutines and you will be fine.
October 6, 2003, 11:49 PM

Search