Valhalla Legends Forums Archive | Battle.net Bot Development | How do i load from a listbox

AuthorMessageTime
TriCk
how do i choose items from a listbox ?
say like an access thing... ?
May 23, 2003, 12:20 PM
drivehappy
[quote]Private Sub List1_Click()
MsgBox List1.List(List1.ListIndex)
End Sub
[/quote]
May 23, 2003, 9:12 PM
TriCk
hmmm
I tried that with cleanslatebot ...
Code:
CleanSlateBot_UserJoins
If Username = List.List(List.ListIndex) Then
'Don't Ban
Else If Username = Username Then
CleanSlateBot.Send "/ban " & username


Doesnt work...
how would i get it to work with that sort of setup i have there ?
May 24, 2003, 12:34 AM
drivehappy
CleanSlateBot_UserJoins
If trim(ucase(Username)) = trim(ucase(List.List(List.ListIndex))) Then
'Don't Ban
Else
CleanSlateBot.Send "/ban " & Username
End If

Try that.
May 24, 2003, 12:58 AM
TriCk
hmmm thats still not working
I have my name on the list but if i join it still bans me...
are u sure that code is right ?
May 24, 2003, 1:19 AM
Camel
that code compares the name of the user joining to the value of the [color=red]selected[/color] item in the list. you probably want to search through the list and compare the users name to every entry, rather than just the selected one.
May 24, 2003, 1:30 AM
TriCk
yeah how would i do that?
code please
i'm sorta newb to vb6 :(
May 24, 2003, 3:37 AM
TriCk
how do i find a username in a listbox so they dont get banned when they join ?
May 24, 2003, 7:36 AM
drivehappy
CleanSlateBot_UserJoins()
For X = 0 to List1.Listcount -1
If trim(ucase(Username)) = trim(ucase(List1.List(X)) Then
'Don't Ban
ElseIf Trim(UCase(Username)) <> List1.List(X) and X = (List1.Listcount - 1) Then
CleanSlateBot.Send "/ban " & Username
End If
Next
May 24, 2003, 10:16 PM
TriCk
Thanks DriveHappy ;D
May 24, 2003, 11:41 PM
TriCk
hmmm...
one more thing... it only works for 1 person if i put more than 1 person in the listbox it bans the first one whys it doin that ??
May 25, 2003, 12:00 AM
MesiaH
finditem.
May 25, 2003, 12:12 AM
Camel
[quote author=TriCk link=board=17;threadid=1405;start=0#msg10542 date=1053761789]
how do i find a username in a listbox so they dont get banned when they join ?
[/quote]

[quote author=Camel link=board=17;threadid=1405;start=0#msg10521 date=1053739824]
...search through the list and compare the users name to every entry...
[/quote]
or use the [listbox].FindItem method as mesiah pointed out
May 25, 2003, 3:00 AM
TriCk
are u talking about VB .net ? Coz i dont think on VB6 they have ListBox.FindItem ...?

I also own VB .net but im using vb6 for this bot
May 25, 2003, 3:39 AM
drivehappy
Trick, it depends on what you have Username set to when you loop it. I'm trying to figure out what you're not doing right, so this is my best guess:

[code]CleanSlateBot_UserJoins()
Dim Username() as String
For Y = 0 to UBound.Username
For X = 0 to List1.Listcount -1
If trim(ucase(Username(Y))) = trim(ucase(List1.List(X)) Then
'Don't Ban
Exit For
ElseIf Trim(UCase(Username(Y))) <> List1.List(X) and X = (List1.Listcount - 1 Then
CleanSlateBot.Send "/ban " & Username(Y)
Exit For
End If
Next
Next[/code]

Kind of messy, but it should work. The Username array should contain all the usernames you don't want banned.

Edit: use [ code ] tags.
May 25, 2003, 8:29 PM
Camel
no drivehappy, that wont work
you have to check every user agains the entire username() array. you're checking everyone against the array one entry at a time and banning them if they're not that element in the array.
May 26, 2003, 4:44 PM

Search