Author | Message | Time |
---|---|---|
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? | September 26, 2004, 12:17 AM |
Newby | Look up InStr() | September 26, 2004, 12:38 AM |
UserLoser. | [quote author=Yegg link=board=31;threadid=8848;start=0#msg82047 date=1096157843] 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? [/quote] For something basic, look up the Like operator. | September 26, 2004, 12:43 AM |
Yegg | 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: | September 26, 2004, 2:02 AM |
UserLoser. | [quote author=Yegg link=board=31;threadid=8848;start=0#msg82053 date=1096164166] 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: [/quote] Probably be a better idea to do: [code] CleanSlateBot1.Send "/ban " & Username [/code] If someone does .ban user, wouldn't that send "/ban user" when you're wanting to ban all UserLosers? | September 26, 2004, 2:09 AM |
St0rm.iD | I really, really insist that you use LIKE. | September 26, 2004, 4:21 AM |
CrAz3D | [code]If "jim" Like "*i*" Then[/code] 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. | September 26, 2004, 4:38 AM |
Yegg | 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: [code]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:[/code] | September 26, 2004, 10:32 PM |
Yegg | k, userloser, ur way worked fine, only heres the code im using, and whenever i use it the bot gets an error within seconds: [code]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:[/code] 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: [code]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[/code] | September 26, 2004, 11:36 PM |
Yegg | Ok i changed my command and it almost works only 1 problem is that it wil only ban me, heres the code: [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[/code] | September 27, 2004, 1:48 AM |
Stealth | Several things to think about. 1: Where's your Tab key? 2: [code]tmrWild.Interval = "4000"[/code] The Interval property is stored as a number. Why are you passing it a string? [code]tmrWild.Interval = 4000[/code] 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. | September 27, 2004, 5:05 AM |
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. [code] rs.Filter = "UserName='%[vL]%'" If rs.RecordCount > 0 Then 'do stuff with matching records... End If [/code] | September 27, 2004, 5:26 AM |
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? | September 27, 2004, 10:18 PM |
Puzzle | [code]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:[/code] 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. | September 28, 2004, 5:14 PM |
Yegg | Ok, i just tried another way in doing wildcards, here it is: (plz dotn correct me with timers, im just trying this out) [code]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:[/code] 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: [code]If InStr(1, username, splt(1), vbTextCompare) <> 0 Then[/code] | September 28, 2004, 9:24 PM |
-MichaeL- | I would like to know what is the point of the timers? | September 29, 2004, 9:06 PM |
Yegg | i'll let u figure this out on ur own with 1 small hint.....ipbanned from flooding... | September 29, 2004, 10:02 PM |
-MichaeL- | That has to be the worst idea for a queue system i have ever seen.... Wow...... anyway i suggest useing a array and one timer. then make the timer send out the array, But before it sends it checks text lenth as in [code] public sub arraycheckandsend(own as boolean) if own = false then if len(array(0).text) =<59 then timer.interval = 6000 send array(0).text else timer.interval = 3500 send array(0).text end if. else send left(array(0).text), 59) send left(array(0).text), 59) send left(array(0).text), 59) send left(array(0).text), 59) timer.interval = 12000 end if [/code] or something along them lines that dosent require alot of pointless timers which uses more ram then needed. also you will have to design a code to remove the array(0).text and make array(1).text into array(0) which can be done but i don't have the time to post the code. | September 30, 2004, 1:08 AM |