Valhalla Legends Forums Archive | Battle.net Bot Development | LIstview removing....

AuthorMessageTime
OuTLawZGoSu
Sup... this is what i need. i have a listvew called "Channellist" i need to get a code where a user leaves the channel and it removes teh user fromt eh list. this is the code i have so far:

Case ID_JOIN

Form1.List1.AddItem username & " [" & Ping & "] - " & message, 0

Form1.ChannelList.ListItems.add 1, , username

If Form4.Check5 = vbChecked Then
AddC vbGreen, username & " has joined the channel"
End If

Case ID_LEAVE

If Form4.Check5 = vbChecked Then
AddC vbGreen, username & " has left the channel"
Form1.ChannelList.ListItems.remove 1

End If

Form1.List1.RemoveItem SendMessage(Form1.List1.hwnd, LB_FINDSTRING, 0, username & " [" & Ping & "] - " & message)
End Select
Exit Sub

Where it sais "Form1.ChannelList.ListItems.remove 1" thats where the username gets removed. Just that when any user leaves it will always take off the 1st username and not the one that left. i dont get how to make that work..

Some one help?

L8terZ
August 18, 2003, 3:19 PM
Soul Taker
You're always removing the first item rather than finding and removing the user.

Something like
[code]
For x = 1 to Form1.ChannelList.ListItems.Count
If Form1.ChannelList.ListItems.Item(x).text = username then
Form1.ChannelList.ListItems.remove x
End If
Next x
[/code]
should work.
August 18, 2003, 4:33 PM
______
[quote author=Soul Taker link=board=17;threadid=2380;start=0#msg18620 date=1061224406]
You're always removing the first item rather than finding and removing the user.

Something like
[code]
For x = 1 to Form1.ChannelList.ListItems.Count
If Form1.ChannelList.ListItems.Item(x).text = username then
Form1.ChannelList.ListItems.remove x
End If
Next x
[/code]
should work.
[/quote]

should work better
[code]
Form1.channellist.ListItems.Remove Form1.ChannelList.FindItem(Username).Index '
[/code]
August 18, 2003, 4:56 PM
OuTLawZGoSu
Ok... now this is what i have...

[code]
Case ID_JOIN

Form1.ChannelList.ListItems.add 1, , username

If Form4.Check5 = vbChecked Then
AddC vbGreen, username & " has joined the channel"
End If

Case ID_LEAVE

If Form4.Check5 = vbChecked Then
AddC vbGreen, username & " has left the channel"
Form1.ChannelList.ListItems.remove 1

End If
End Select
Exit Sub
[/code]

It all works good just I need more then jsut the screenname. I need the ping in the next column and the client in the 3rdcolumn. can you help me out?

L8terr
August 18, 2003, 7:43 PM
______
[quote author=OuTLawZGoSu link=board=17;threadid=2380;start=0#msg18638 date=1061235827]
Ok... now this is what i have...

[code]
Case ID_JOIN

Form1.ChannelList.ListItems.add 1, , username

If Form4.Check5 = vbChecked Then
AddC vbGreen, username & " has joined the channel"
End If

Case ID_LEAVE

If Form4.Check5 = vbChecked Then
AddC vbGreen, username & " has left the channel"
Form1.ChannelList.ListItems.remove 1

End If
End Select
Exit Sub
[/code]

It all works good just I need more then jsut the screenname. I need the ping in the next column and the client in the 3rdcolumn. can you help me out?

L8terr
[/quote]
that is the same thing you had in the your first post
August 18, 2003, 7:56 PM
OuTLawZGoSu
Oh shit, you're right. Srry bgout that..

Tis is the righ tcode:

[code]

Case ID_JOIN

Form1.ChannelList.ListItems.add 1, , username
If Form4.Check5 = vbChecked Then
AddC vbGreen, username & " has joined the channel"
End If
End If


Case ID_LEAVE
For X = 1 To Form1.ChannelList.ListItems.Count
If Form1.ChannelList.ListItems.Item(X).Text = username Then
Form1.ChannelList.ListItems.Remove X
End If
Next X

If Form4.Check5 = vbChecked Then
AddC vbGreen, username & " has left the channel"
End If

End Select
Exit Sub

End Sub

[/code]

t all works good just I need more then jsut the screenname. I need the ping in the next column and the client in the 3rd column.
August 18, 2003, 8:51 PM
Soul Taker
[quote author=___/\___ link=board=17;threadid=2380;start=0#msg18626 date=1061225816]
[quote author=Soul Taker link=board=17;threadid=2380;start=0#msg18620 date=1061224406]
You're always removing the first item rather than finding and removing the user.

Something like
[code]
For x = 1 to Form1.ChannelList.ListItems.Count
If Form1.ChannelList.ListItems.Item(x).text = username then
Form1.ChannelList.ListItems.remove x
End If
Next x
[/code]
should work.
[/quote]

should work better
[code]
Form1.channellist.ListItems.Remove Form1.ChannelList.FindItem(Username).Index '
[/code]
[/quote]
What if you want your bot to be able to connect to user-made servers which might not gauruntee unique accounts!
August 19, 2003, 5:21 PM
______
[quote author=Soul Taker link=board=17;threadid=2380;start=0#msg18717 date=1061313707]
[quote author=___/\___ link=board=17;threadid=2380;start=0#msg18626 date=1061225816]
[quote author=Soul Taker link=board=17;threadid=2380;start=0#msg18620 date=1061224406]
You're always removing the first item rather than finding and removing the user.

Something like
[code]
For x = 1 to Form1.ChannelList.ListItems.Count
If Form1.ChannelList.ListItems.Item(x).text = username then
Form1.ChannelList.ListItems.remove x
End If
Next x
[/code]
should work.
[/quote]

should work better
[code]
Form1.channellist.ListItems.Remove Form1.ChannelList.FindItem(Username).Index '
[/code]
[/quote]
What if you want your bot to be able to connect to user-made servers which might not gauruntee unique accounts!
[/quote]
you should be able to replace username with whatever your using.
August 19, 2003, 5:26 PM
OuTLawZGoSu
Thx ... But no wi need to put the username and the ping in diferent columns. can you tell me how to do that? i have 2 columns already, i just need to ge tthe code to put the ping in the secon one.
August 20, 2003, 1:48 AM
Arta
[quote author=Soul Taker link=board=17;threadid=2380;start=0#msg18717 date=1061313707]
What if you want your bot to be able to connect to user-made servers which might not gauruntee unique accounts!
[/quote]

That server would be incredibly broken. Given the brokenness, there's no guaranteed way.

That said, server splits and wierd errors can cause 2 users with the same name to be present in the channel at the same time. If you want to be very safe, you should check the ping as well as the username to make sure it's the same.

On broken servers that often doesn't work, though, because some of them (*cough* BnetD/PVPGN) update clients' pings in flag updates after they've logged on.
August 20, 2003, 8:32 AM
Camel
BTW, PVPGN == BnetD++
August 21, 2003, 3:36 AM
Eibro
[quote author=Camel link=board=17;threadid=2380;start=0#msg18776 date=1061436995]
BTW, PVPGN == BnetD++
[/quote]Hehe, I think what you really mean is PVPGN == ++BnetD
August 21, 2003, 3:55 AM
Camel
[quote author=Eibro link=board=17;threadid=2380;start=0#msg18778 date=1061438108]
[quote author=Camel link=board=17;threadid=2380;start=0#msg18776 date=1061436995]
BTW, PVPGN == BnetD++
[/quote]Hehe, I think what you really mean is PVPGN == ++BnetD
[/quote]I think you mean PVPGN = BnetD + 1;
I mean PBPGN == BnetD++ like C++, STFU++, and n00b++.
August 21, 2003, 4:56 AM
Eibro
[quote author=Camel link=board=17;threadid=2380;start=0#msg18781 date=1061441765]
[quote author=Eibro link=board=17;threadid=2380;start=0#msg18778 date=1061438108]
[quote author=Camel link=board=17;threadid=2380;start=0#msg18776 date=1061436995]
BTW, PVPGN == BnetD++
[/quote]Hehe, I think what you really mean is PVPGN == ++BnetD
[/quote]I think you mean PVPGN = BnetD + 1;
I mean PBPGN == BnetD++ like C++, STFU++, and n00b++.
[/quote]In a single statement (eg. C++), the effects of preincrement and postincrement are the same. When put into a statement (as you did above) you need to be careful what you use.
If you really mean what you said above, then BnetD will be 1 greater than PVPGN at the end of the statement. Also, it will evaluate true if both are initially the same value.
;)
August 21, 2003, 6:07 AM

Search