Author | Message | Time |
---|---|---|
Gangz | I am creating a lock down function that does not use queue (made for stopping floods). I was wondering if there is any type of function that can make it not send to times. If Form1.chklock = vbChecked Then Form1.Send "/ban " & username & " Lockdown" & lockname Message = "/ban " & username & " Lockdown" & lockname Message is the one that needs to not be repeated | December 30, 2003, 10:40 PM |
iago | I don't see what you're having a problem with. It doesn't seem very difficult,does it? | December 30, 2003, 10:44 PM |
UserLoser. | I know a few great bots that use a queue and can ban flood bots, if it tries to | December 30, 2003, 10:44 PM |
Gangz | Yea but very few.. I tested my bot on evey flood i could find and banned titan 4 times on 4 rj and turtle bot 2 times on 2 1 rj floods. The project seems wirth the time. | December 30, 2003, 11:40 PM |
______ | Here is an example on what you could do, [code] If Not Message = LastMessage then 'Do whatever End If [/code] | December 30, 2003, 11:48 PM |
Spht | [quote author=Gangz link=board=17;threadid=4518;start=0#msg37668 date=1072827609] Yea but very few.. I tested my bot on evey flood i could find and banned titan 4 times on 4 rj and turtle bot 2 times on 2 1 rj floods. The project seems wirth the time. [/quote] Sounds like really inefficient coding. You should be using a queue for messages and delay sends appropriately, otherwise you could easily spam yourself off Battle.net. A message queue will also allow you to check for duplicated op commands which you can exclude. | December 31, 2003, 12:09 AM |
Gangz | I do have a queue that can be customized by commands, but it seems that if I do lockdowns it sends 2 messages withought queue for the speed and then goes into the queue. I just want to avoid sending the same message twice just incase it was a mulitple flood or somthing. | December 31, 2003, 12:40 AM |
o.OV | ok. you arent using a queue for lockdown [code] 'on user joins SplitUserName = Split(UCase(UserName), "#")(0) If GetTickCount - LastTick > 4000 And InOps And InStr(SafeList, "<" & SplitUserName & ">") = 0 Then If ChannelProtect Or InStr(ShitList, "<" & SplitUserName & ">") Or flags = 32 Or flags = 48 Then Ban UserName: LastTick = GetTickCount Else For xx = 1 To UBound(TagList) If UCase(SplitUserName) Like UCase(TagList(xx)) Then Ban UserName: LastTick = GetTickCount: Exit For Next xx End If End If [/code] | December 31, 2003, 2:03 AM |
Kp | [quote author=o.OV link=board=17;threadid=4518;start=0#msg37680 date=1072836192] ok. you arent using a queue for lockdown [code] 'on user joins SplitUserName = Split(UCase(UserName), "#")(0) If GetTickCount - LastTick > 4000 And InOps And InStr(SafeList, "<" & SplitUserName & ">") = 0 Then If ChannelProtect Or InStr(ShitList, "<" & SplitUserName & ">") Or flags = 32 Or flags = 48 Then Ban UserName: LastTick = GetTickCount Else For xx = 1 To UBound(TagList) If UCase(SplitUserName) Like UCase(TagList(xx)) Then Ban UserName: LastTick = GetTickCount: Exit For Next xx End If End If [/code] [/quote] What incredibly horrible code! Among other failings, it tries to treat a bitmask as discrete values. Use bitwise and to test their flags. | December 31, 2003, 2:30 AM |
o.OV | [quote author=Kp link=board=17;threadid=4518;start=0#msg37685 date=1072837810] [quote author=o.OV link=board=17;threadid=4518;start=0#msg37680 date=1072836192] ok. you arent using a queue for lockdown [code] 'on user joins SplitUserName = Split(UCase(UserName), "#")(0) If GetTickCount - LastTick > 4000 And InOps And InStr(SafeList, "<" & SplitUserName & ">") = 0 Then If ChannelProtect Or InStr(ShitList, "<" & SplitUserName & ">") Or flags = 32 Or flags = 48 Then Ban UserName: LastTick = GetTickCount Else For xx = 1 To UBound(TagList) If UCase(SplitUserName) Like UCase(TagList(xx)) Then Ban UserName: LastTick = GetTickCount: Exit For Next xx End If End If [/code] [/quote] What incredibly horrible code! Among other failings, it tries to treat a bitmask as discrete values. Use bitwise and to test their flags. [/quote] .. well how would u rather do it i know u are a better coder then me so help us out instead of telling me that my coding is horrid and please point out the other horrible parts of my coding .. then i can improve on it. thx kp | December 31, 2003, 2:49 AM |
o.OV | Ah. Look kP [code] ' Spht's example If (flags and &H20) Then [/code] its an example i found on bitmask comparison now what other improvements can be done for the code i provided? | December 31, 2003, 4:07 AM |
Kp | [quote author=o.OV link=board=17;threadid=4518;start=0#msg37701 date=1072843673] now what other improvements can be done for the code i provided?[/quote] Well, I'd suggest storing your safelist and banlist in a true list of some sort rather than as a massive string with illegal characters to delimit entries. As I recall, VB's support for such things tends to be rather poor though, so you may have some difficulty making it work. I'll leave it to the VB gurus to explain how to implement the list (it'd be trivial in C, not so in VB afaik). | December 31, 2003, 5:01 AM |
Spht | [quote author=o.OV link=board=17;threadid=4518;start=0#msg37701 date=1072843673] Ah. Look kP [code] ' Spht's example If (flags and &H20) Then [/code] its an example i found on bitmask comparison now what other improvements can be done for the code i provided? [/quote] I don't believe that's my example. I usually check if the result is actually equal to what I'm checking, and not only checking if it's greater than zero. If you only check if it's greater than zero, you may run into some unwanted happenings. | December 31, 2003, 5:35 AM |
Grok | [quote author=Kp link=board=17;threadid=4518;start=0#msg37710 date=1072846900] [quote author=o.OV link=board=17;threadid=4518;start=0#msg37701 date=1072843673] now what other improvements can be done for the code i provided?[/quote] Well, I'd suggest storing your safelist and banlist in a true list of some sort rather than as a massive string with illegal characters to delimit entries. As I recall, VB's support for such things tends to be rather poor though, so you may have some difficulty making it work. I'll leave it to the VB gurus to explain how to implement the list (it'd be trivial in C, not so in VB afaik). [/quote] Nah, quite easy to do in VB, really. To wit: [code] Private Function OpenList(ByVal ListName As String) As ADODB.Recordset Dim rs As ADODB.Recordset Dim fso As Scripting.FileSystemObject Dim sFile As String Set fso = New Scripting.FileSystemObject sFile = fso.BuildPath(App.Path, ListName & ".xml") Set rs = New ADODB.Recordset rs.CursorLocation = adUseClient If fso.FileExists(sFile) = True Then rs.Open sFile Else rs.Fields.Append "UserName", adVarChar, 30 rs.Fields.Append "Namespace", adVarChar, 30 rs.Fields.Append "Flags", adInteger rs.Fields.Append "DateAdded", adDate rs.Fields.Append "LastSeen", adDate rs.Fields.Append "Notes", adVarChar, 200 rs.Open rs.Save sFile, adPersistXML End If Set OpenList = rs End Function [/code] | December 31, 2003, 2:09 PM |
o.OV | [quote author=Spht link=board=17;threadid=4518;start=0#msg37713 date=1072848933] [quote author=o.OV link=board=17;threadid=4518;start=0#msg37701 date=1072843673] Ah. Look kP [code] ' Spht's example If (flags and &H20) Then [/code] its an example i found on bitmask comparison now what other improvements can be done for the code i provided? [/quote] I don't believe that's my example. I usually check if the result is actually equal to what I'm checking, and not only checking if it's greater than zero. If you only check if it's greater than zero, you may run into some unwanted happenings. [/quote] Oh =\ I thought that was you. Perhaps I misread the post. [quote author=Spht link=board=17;threadid=1838;start=#msg14270 date=1057765134] [quote author=______ link=board=17;threadid=1838;start=0#msg14260 date=1057759735] put this on your join command [code] If flags = &H20 Then cleanslatebot2.send "/ban " & username & " Ban Evasion Detected" endif [/code] [/quote] Note that would fail if the user has "plug" (0x10). You should be doing a bitmask comparison for this type of thing. Example: [code]If (flags and &H20) Then[/code] [/quote] Ok. So maybe that wasn't you or maybe it was. But if what you say is true and I might run into unwanted happenings then how should I properly make the comparison? [quote author=Kp link=board=17;threadid=4518;start=0#msg37710 date=1072846900] [quote author=o.OV link=board=17;threadid=4518;start=0#msg37701 date=1072843673] now what other improvements can be done for the code i provided?[/quote] Well, I'd suggest storing your safelist and banlist in a true list of some sort rather than as a massive string with illegal characters to delimit entries. As I recall, VB's support for such things tends to be rather poor though, so you may have some difficulty making it work. I'll leave it to the VB gurus to explain how to implement the list (it'd be trivial in C, not so in VB afaik). [/quote] Reason why I avoid an array is because I normally use a loop to go through an array. I'll go look at the filter function again perhaps I missed something | December 31, 2003, 5:05 PM |
o.OV | [quote author=Kp link=board=17;threadid=4518;start=0#msg37710 date=1072846900] [quote author=o.OV link=board=17;threadid=4518;start=0#msg37701 date=1072843673] now what other improvements can be done for the code i provided?[/quote] Well, I'd suggest storing your safelist and banlist in a true list of some sort rather than as a massive string with illegal characters to delimit entries. As I recall, VB's support for such things tends to be rather poor though, so you may have some difficulty making it work. I'll leave it to the VB gurus to explain how to implement the list (it'd be trivial in C, not so in VB afaik). [/quote] I don't expect a response from you since u said you will let the VB gurus explain how to implement the list. But I took a look at the filter function and this is the best I can come up with. [code] Private Sub Form_Load() sArray = Array("<test1>", "<test>", "<3test>", "<4test4>") strng = "<test>" result = Filter(sArray, strng) Debug.Print result(0) 'For x = LBound(result) To UBound(result) ' Debug.Print result(x) 'Next x End Sub [/code] I wish to avoid any type of VB loop. | December 31, 2003, 6:25 PM |
o.OV | [quote author=Grok link=board=17;threadid=4518;start=0#msg37734 date=1072879774] [quote author=Kp link=board=17;threadid=4518;start=0#msg37710 date=1072846900] [quote author=o.OV link=board=17;threadid=4518;start=0#msg37701 date=1072843673] now what other improvements can be done for the code i provided?[/quote] Well, I'd suggest storing your safelist and banlist in a true list of some sort rather than as a massive string with illegal characters to delimit entries. As I recall, VB's support for such things tends to be rather poor though, so you may have some difficulty making it work. I'll leave it to the VB gurus to explain how to implement the list (it'd be trivial in C, not so in VB afaik). [/quote] Nah, quite easy to do in VB, really. To wit: [code] Private Function OpenList(ByVal ListName As String) As ADODB.Recordset Dim rs As ADODB.Recordset Dim fso As Scripting.FileSystemObject Dim sFile As String Set fso = New Scripting.FileSystemObject sFile = fso.BuildPath(App.Path, ListName & ".xml") Set rs = New ADODB.Recordset rs.CursorLocation = adUseClient If fso.FileExists(sFile) = True Then rs.Open sFile Else rs.Fields.Append "UserName", adVarChar, 30 rs.Fields.Append "Namespace", adVarChar, 30 rs.Fields.Append "Flags", adInteger rs.Fields.Append "DateAdded", adDate rs.Fields.Append "LastSeen", adDate rs.Fields.Append "Notes", adVarChar, 200 rs.Open rs.Save sFile, adPersistXML End If Set OpenList = rs End Function [/code] [/quote] Wow Grok. | December 31, 2003, 6:35 PM |
Spht | [quote author=o.OV link=board=17;threadid=4518;start=0#msg37760 date=1072890327] Ok. So maybe that wasn't you or maybe it was. [/quote] You got me.[code]If (flags and &H20) = &H20 Then[/code]To explain why, run this:[code] Dim i As Long Dim flags As Long flags = &H20 Debug.Print "Checking &H" & Hex(flags) & " with flags 0 to 255 using If (flags And i) = i Then:" For i = 1 To &HFF If (flags And i) = i Then Debug.Print "(&H" & Hex(flags) & " And &H" & Hex(i) & ") = &H" & Hex(flags And i) Next i Debug.Print "Checking &H" & Hex(flags) & " with flags 0 to 255 using If (flags And i) Then:" For i = 1 To &HFF If (flags And i) Then Debug.Print "(&H" & Hex(flags) & " And &H" & Hex(i) & ") = &H" & Hex(flags And i) Next i[/code] | December 31, 2003, 6:43 PM |
Spht | [quote author=o.OV link=board=17;threadid=4518;start=15#msg37775 date=1072895135] [code] sArray = Array("<test1>", "<test>", "<3test>", "<4test4>") strng = "<test>" [/code] [/quote] What's with the angle brackets? | December 31, 2003, 6:45 PM |
o.OV | [quote author=Spht link=board=17;threadid=4518;start=15#msg37780 date=1072896308] [quote author=o.OV link=board=17;threadid=4518;start=15#msg37775 date=1072895135] [code] sArray = Array("<test1>", "<test>", "<3test>", "<4test4>") strng = "<test>" [/code] [/quote] What's with the angle brackets? [/quote] without it.. [code] Private Sub Form_Load() sArray = Array("test1", "test", "3test", "4test4") strng = "test" result = Filter(sArray, strng) 'Debug.Print result(0) For x = LBound(result) To UBound(result) Debug.Print result(x) Next x End Sub [/code] it would return all 4 items in the array | December 31, 2003, 6:48 PM |
o.OV | [quote author=Spht link=board=17;threadid=4518;start=15#msg37779 date=1072896228] [quote author=o.OV link=board=17;threadid=4518;start=0#msg37760 date=1072890327] Ok. So maybe that wasn't you or maybe it was. [/quote] You got me.[code]If (flags and &H20) = &H20 Then[/code]To explain why, run this:[code] Dim i As Long Dim flags As Long flags = &H20 Debug.Print "Checking &H" & Hex(flags) & " with flags 0 to 255 using If (flags And i) = i Then:" For i = 1 To &HFF If (flags And i) = i Then Debug.Print "(&H" & Hex(flags) & " And &H" & Hex(i) & ") = &H" & Hex(flags And i) Next i Debug.Print "Checking &H" & Hex(flags) & " with flags 0 to 255 using If (flags And i) Then:" For i = 1 To &HFF If (flags And i) Then Debug.Print "(&H" & Hex(flags) & " And &H" & Hex(i) & ") = &H" & Hex(flags And i) Next i[/code] [/quote] Cool. I'll try that out right now Spht. =) _____ I just tried it out and the results were quite long ^^ but it definitely showed the unwanted results =) thx spht | December 31, 2003, 6:50 PM |
o.OV | [quote author=o.OV link=board=17;threadid=4518;start=15#msg37782 date=1072896611] [quote author=Spht link=board=17;threadid=4518;start=15#msg37779 date=1072896228] [quote author=o.OV link=board=17;threadid=4518;start=0#msg37760 date=1072890327] Ok. So maybe that wasn't you or maybe it was. [/quote] You got me.[code]If (flags and &H20) = &H20 Then[/code]To explain why, run this:[code] Dim i As Long Dim flags As Long flags = &H20 Debug.Print "Checking &H" & Hex(flags) & " with flags 0 to 255 using If (flags And i) = i Then:" For i = 1 To &HFF If (flags And i) = i Then Debug.Print "(&H" & Hex(flags) & " And &H" & Hex(i) & ") = &H" & Hex(flags And i) Next i Debug.Print "Checking &H" & Hex(flags) & " with flags 0 to 255 using If (flags And i) Then:" For i = 1 To &HFF If (flags And i) Then Debug.Print "(&H" & Hex(flags) & " And &H" & Hex(i) & ") = &H" & Hex(flags And i) Next i[/code] [/quote] Cool. I'll try that out right now Spht. =) _____ I just tried it out and the results were quite long ^^ but it definitely showed the unwanted results =) thx spht [/quote] I took another look at it.. [code] flags = &H20 If (flags And &H30) = &H30 or (flags And &H20) = &H20 Then [/code] or [code] flags = 32 If flags = 48 or flags = 32 Then [/code] or [code] flags = &H20 If flags = &H30 or flags = &H20 Then [/code] is code execution faster with the first one? does it make any difference or should i use the first example so the code would look proper am i going at this the wrong way? if i use [code] flags = &H20 If (flags And &H20) Then [/code] i may get TWO unwanted results: &H22 &H32 and there are other flags i dont rememeber such as bnet rep and flags for special icons and yes. i see why using &H would be a better idea flags make more sense | December 31, 2003, 8:18 PM |
o.OV | [quote author=o.OV link=board=17;threadid=4518;start=15#msg37775 date=1072895135] [quote author=Kp link=board=17;threadid=4518;start=0#msg37710 date=1072846900] [quote author=o.OV link=board=17;threadid=4518;start=0#msg37701 date=1072843673] now what other improvements can be done for the code i provided?[/quote] Well, I'd suggest storing your safelist and banlist in a true list of some sort rather than as a massive string with illegal characters to delimit entries. As I recall, VB's support for such things tends to be rather poor though, so you may have some difficulty making it work. I'll leave it to the VB gurus to explain how to implement the list (it'd be trivial in C, not so in VB afaik). [/quote] I don't expect a response from you since u said you will let the VB gurus explain how to implement the list. But I took a look at the filter function and this is the best I can come up with. [code] Private Sub Form_Load() sArray = Array("<test1>", "<test>", "<3test>", "<4test4>") strng = "<test>" result = Filter(sArray, strng) Debug.Print result(0) 'For x = LBound(result) To UBound(result) ' Debug.Print result(x) 'Next x End Sub [/code] I wish to avoid any type of VB loop. [/quote] To remove a String Item .. I use Replace -current To remove a GUI Listbox Item .. I use RemoveItem -I hate using Form based items Now how do I remove an array item without using a loop? | December 31, 2003, 8:42 PM |
MrRaza | You can't? :-\ | January 2, 2004, 1:29 PM |
Grok | [quote author=o.OV link=board=17;threadid=4518;start=15#msg37800 date=1072903354]Now how do I remove an array item without using a loop?[/quote] It is possible, but requires you to first learn how arrays are stored in memory. Then you can write a utility function to remove a specific item by copying the [n+1] elements memory down to [n]'s address, then adjusting the array's header so it knows the new number of elements. TheMinistered may have already researched this, you should ask him. P.S. This appears to be more about Visual Basic than BnetBot Development. Do you have any BnetBot Development questions? | January 2, 2004, 4:43 PM |
o.OV | [quote author=Grok link=board=17;threadid=4518;start=15#msg38037 date=1073061800] [quote author=o.OV link=board=17;threadid=4518;start=15#msg37800 date=1072903354]Now how do I remove an array item without using a loop?[/quote] It is possible, but requires you to first learn how arrays are stored in memory. Then you can write a utility function to remove a specific item by copying the [n+1] elements memory down to [n]'s address, then adjusting the array's header so it knows the new number of elements. TheMinistered may have already researched this, you should ask him. P.S. This appears to be more about Visual Basic than BnetBot Development. Do you have any BnetBot Development questions? [/quote] Here is a link I found on the subject: http://www.developerfusion.com/show/3367/2/ I'm tinkering with it now.. If you can redirect me to a better resource page, please do. =) thx ________ The example they give still uses a loop.. | January 3, 2004, 12:19 AM |