Valhalla Legends Archive

Programming => Battle.net Bot Development => Topic started by: TriCk on May 24, 2003, 09:08 PM

Title: WildCarding?
Post by: TriCk on May 24, 2003, 09:08 PM
Ok It's TriCk again sorry for askin for so much help  :(
I want to know how to wildcard in code not case...
like /ban tr* and it will ban TriCk or something
Thanks
Title: Re:WildCarding?
Post by: Kp on May 24, 2003, 09:34 PM
Quote from: TriCk on May 24, 2003, 09:08 PM
Ok It's TriCk again sorry for askin for so much help  :(
I want to know how to wildcard in code not case...
like /ban tr* and it will ban TriCk or something
Thanks
For each user, if the user matches your wildcarding function, enqueue a ban on that user.  Proceed to the next user and perform the text for them.  You'll need to loop through the list manually; afaik, there are no built-in functions that can wild-match.

P.S. You keep saying "in code not case": what do you mean?
Title: Re:WildCarding?
Post by: TriCk on May 24, 2003, 09:37 PM
P.S. You keep saying "in code not case": what do you mean?

i mean for Commands like:
Select Case(LCase)
Case "say"
and other stuff in here
End Select

by Code I mean:

'say command
If Username = Form2.txtMaster.Text Then
If Left((LCase(Message)), 5) = (Form2.txtTrigger.Text & "say ") Then
Dim saymessage As String
saymessage = Right(Message, (Len(Message) - 5))
CleanSlateBot1.Send saymessage
End If
End If
Title: So really ...
Post by: Kp on May 24, 2003, 09:41 PM
Quote from: TriCk on May 24, 2003, 09:37 PM
P.S. You keep saying "in code not case": what do you mean?

i mean for Commands like:
Select Case(LCase)
Case "say"
and other stuff in here
End Select


by Code I mean:

'say command
If Username = Form2.txtMaster.Text Then
If Left((LCase(Message)), 5) = (Form2.txtTrigger.Text & "say ") Then
Dim saymessage As String
saymessage = Right(Message, (Len(Message) - 5))
CleanSlateBot1.Send saymessage
End If
End If
So it's a way of saying you want us to give you code rather than an abstract description, correct?

Use [ code ] tags, btw.  They make your code easier to read and render.
Title: Re:WildCarding?
Post by: TriCk on May 24, 2003, 10:27 PM
yes i guess...   :-\
do u know how to do it ?
Title: Of course
Post by: Kp on May 25, 2003, 12:06 AM
Quote from: TriCk on May 24, 2003, 10:27 PM
yes i guess...   :-\
do u know how to do it ?
I told you above how to do it. :)  Even ignoring that, it ought to be apparent given my works.
Title: Re:WildCarding?
Post by: TriCk on May 25, 2003, 02:41 AM
Kp i don't know how to Enqueue commands ...
How do u do that with csb ?
Title: Re:WildCarding?
Post by: MrRaza on May 25, 2003, 04:13 PM
this topic has been discussed before, iirc

Search the forums for WildCard

http://forum.valhallalegends.com/phpbbs/index.php?board=17;action=search
Title: Re:WildCarding?
Post by: UserLoser on May 25, 2003, 07:28 PM
If "you should die" Like "*should*" Then MsgBox "You should die soon"
Title: Re:WildCarding?
Post by: TheMinistered on May 25, 2003, 09:43 PM
Yes, userlooser, you are correct.  For those of you who were to stupid to read between the lines, Userlooser is referring to the LIKE operator.  If you want to know how to use it, then, I suggest you look it up on msdn.

As to how to do a /ban tr* and have it ban user "trick"... you could have some sort of abstract data structure that i am going to call a list.  you would cycle through the list and use the LIKE operator to determine if that item in the list should be banned or not.  This thought may not be complete or right, but I'm insanely tired and I hope this helps
Title: Re:WildCarding?
Post by: TriCk on May 26, 2003, 12:57 AM
Thanks for the help ill try and figure it out with the Like Commands I guess ...

Just a thought do u think something like this would be correct:



If UserName Like "a" Then
CleanSlateBot1.Send "/ban " & Username
???

Title: Re:WildCarding?
Post by: iago on May 26, 2003, 01:16 AM
Like isn't a command, it's an operator.
Title: Re:WildCarding?
Post by: ______ on May 26, 2003, 01:27 AM
Quote from: TriCk on May 26, 2003, 12:57 AM
Thanks for the help ill try and figure it out with the Like Commands I guess ...

Just a thought do u think something like this would be correct:



If UserName Like "a" Then
CleanSlateBot1.Send "/ban " & Username
???



that wouldnt work very well u might wanna try Lcase(username) Like "a"   that would be a little better.
and also if a user joined you would flood off with that code for trying to ban the user(s) with an "a"  :-\
Title: Re:WildCarding?
Post by: MrRaza on May 26, 2003, 06:43 AM
A while back i posted code that printed out the percentage of how much a string was "like" another string. Search the forums for my posts, say 3 pages back.