• Welcome to Valhalla Legends Archive.
 

Help with wildcards!

Started by Yegg, September 25, 2004, 07:17 PM

Previous topic - Next topic

Yegg

I cant seem to figure out how to work wildcards for my bot. all i want to know how to do is have a command that makes it so lets say i wanted something like !kill load. ne1 with load in their name would get banned. Can ne1 help me do this correctly?

Newby

- Newby

Quote[17:32:45] * xar sets mode: -oooooooooo algorithm ban chris cipher newby stdio TehUser tnarongi|away vursed warz
[17:32:54] * xar sets mode: +o newby
[17:32:58] <xar> new rule
[17:33:02] <xar> me and newby rule all

Quote<TehUser> Man, I can't get Xorg to work properly.  This sucks.
<torque> you should probably kill yourself
<TehUser> I think I will.  Thanks, torque.

UserLoser.

#2
Quote from: Yegg on September 25, 2004, 07:17 PM
I cant seem to figure out how to work wildcards for my bot. all i want to know how to do is have a command that makes it so lets say i wanted something like !kill load. ne1 with load in their name would get banned. Can ne1 help me do this correctly?

For something basic, look up the Like operator.

Yegg

#3
I think i'll stick with InStr() (i forgot about that)
Im not sure exactly how 2 go about doing this, so far i have:

If InStr(1, username, splt(1), vbTextCompare) <> 0 Then
CleanSlateBot1.Send "/ban " & splt(1)
End If
GoTo Done121
Done121:

UserLoser.

Quote from: Yegg on September 25, 2004, 09:02 PM
I think i'll stick with InStr() (i forgot about that)
Im not sure exactly how 2 go about doing this, so far i have:

If InStr(1, username, splt(1), vbTextCompare) <> 0 Then
CleanSlateBot1.Send "/ban " & splt(1)
End If
GoTo Done121
Done121:

Probably be a better idea to do:


CleanSlateBot1.Send "/ban " & Username


If someone does .ban user, wouldn't that send "/ban user" when you're wanting to ban all UserLosers?

Banana fanna fo fanna

I really, really insist that you use LIKE.

CrAz3D

If "jim" Like "*i*" Then

The full string is on the left, the one with the wildcard is on the right.  Don't forget to use the asterixs correctly though.
rebundance - having or being in excess of sheer stupidity
(ré-bun-dance)
Quote from: Spht on June 22, 2004, 07:32 PMSlap.
Quote from: Adron on January 28, 2005, 09:17 AMIn a way, I believe that religion is inherently evil, which includes Christianity. I'd also say Christianity is eviller than Buddhism (has more potential for evil).
Quote from: iago on April 19, 2005, 01:06 PM
CrAz3D's ... is too big vertically, at least, too big with ... iago ...

Yegg

#7
ok, im getting really confused with this Like code.
I dont get how to use it in a command, like if i had a user with access say !own 123, every1 with 123 in their name would get banned, i am not sure where to put the code or how 2 correctly use it, right now i have:

If LCase(splt(0)) = Trigger & "own" And LCase(username) = Master Then
(i dont know wut would go here)
CleanSlateBot1.Send "/ban " & username
End If
GoTo Done
Done:

Yegg

#8
k, userloser, ur way worked fine, only heres the code im using, and whenever i use it the bot gets an error within seconds:

If LCase(splt(0)) = Trigger & "own" And LCase(username) = Master And InStr(1, username, splt(1), vbTextCompare) <> 0 Then
Form1.tmrWild.Interval = "3000"
Form1.tmrWild.Enabled = True
Form1.tmrWild2.Interval = "3000"
Form1.tmrWild2.Enabled = True
Form1.tmrWild.Enabled = False
Form1.tmrWild2.Enabled = False
Form1.tmrWild.Interval = "4000"
Form1.tmrWild.Enabled = True
Form1.tmrWild2.Interval = "4000"
Form1.tmrWild2.Enabled = True
Form1.tmrWild.Enabled = False
Form1.tmrWild2.Enabled = False
Form1.tmrWild.Interval = "3000"
Form1.tmrWild.Enabled = True
Form1.tmrWild2.Interval = "3000"
Form1.tmrWild2.Enabled = False
End If
GoTo Done190
Done190:


I dunno y i used so many timers, but the bot bans users every 3 seconds.
U may need this code to, its the code to my timer:

Private Sub tmrWild_Timer()
If lstWild.ListCount = 0 Then
Exit Sub
End If
CleanSlateBot1.Send "/ban " & lstWild.List(0) & " OWNED!"
lstWild.RemoveItem username
End Sub

Yegg

Ok i changed my command and it almost works only 1 problem is that it wil only ban me, heres the code:

If LCase(splt(0)) = Trigger & "own" And InStr(1, username, splt(1), vbTextCompare) <> 0 And LCase(username) = Master Then
lstWild.AddItem username
Form1.tmrWild.Interval = "3000"
Form1.tmrWild.Enabled = True
Form1.tmrWild2.Interval = "3000"
Form1.tmrWild2.Enabled = True
Form1.tmrWild.Enabled = False
Form1.tmrWild2.Enabled = False
Form1.tmrWild.Interval = "4000"
Form1.tmrWild.Enabled = True
Form1.tmrWild2.Interval = "4000"
Form1.tmrWild2.Enabled = True
Form1.tmrWild.Enabled = False
Form1.tmrWild2.Enabled = False
Form1.tmrWild.Interval = "3000"
Form1.tmrWild.Enabled = True
Form1.tmrWild2.Interval = "3000"
Form1.tmrWild2.Enabled = False
GoTo Done190
Done190:
End If

Stealth

Several things to think about.

1: Where's your Tab key?
2:

tmrWild.Interval = "4000"

The Interval property is stored as a number. Why are you passing it a string?

tmrWild.Interval = 4000

3: The chunk of code you just showed us is executed by you computer in less than a millisecond. There's no time in there to ban anyone or take any actions, because the timers each need 3000-4000 milliseconds to fire.
- Stealth
Author of StealthBot

Grok

Take advantage of the ADODB Recordset object so you can do SQL queries.  Load the recordset with the data against which you want to query.  With the Filter property, set the value to a SQL WHERE clause.


rs.Filter = "UserName='%[vL]%'"
If rs.RecordCount > 0 Then
    'do stuff with matching records...
End If

Yegg

Ok, i dont need all this extra help, i just want to know which item i have to add to lstWild. If i add username it only adds the person doing the command. Any help with this?

Puzzle

If LCase(splt(0)) = Trigger & "own" And LCase(username) = Master Then
(i dont know wut would go here)
CleanSlateBot1.Send "/ban " & username
End If
GoTo Done
Done:

If you implemented this, your code would ban the users that issued the command to the bot. You need to ban the username that matches the string you are comparing with.

Also, don't tell people you don't want their help if you post here. This thread will not only help you but any users that visit it in the future or will prevent threads like this if people use the Search page.

Yegg

#14
Ok, i just tried another way in doing wildcards, here it is: (plz dotn correct me with timers, im just trying this out)

If LCase(splt(0)) = Trigger & "own" And LCase(username) = Master Then
End If
If InStr(1, username, splt(1), vbTextCompare) <> 0 Then
lstWild.AddItem username
Form1.tmrWild.Interval = "1000"
Form1.tmrWild.Enabled = True
Form1.tmrWild2.Interval = "1000"
Form1.tmrWild2.Enabled = True
Form1.tmrWild3.Interval = "1000"
Form1.tmrWild3.Enabled = True
Form1.tmrWild.Interval = "5000"
Form1.tmrWild.Enabled = True
Form1.tmrWild2.Interval = "5000"
Form1.tmrWild2.Enabled = True
Form1.tmrWild3.Interval = "5000"
Form1.tmrWild3.Enabled = True
End If
GoTo Done253
Done253:


the only problem is that after the bot gets the chance to add a few usernames to a listbox, before it adds them all and then bans them, i get an error on the following line of code:

If InStr(1, username, splt(1), vbTextCompare) <> 0 Then