autopilot wrote:With VB6, the InStr function returns the possition if a string match is found. It does not matter were in the line it matches, or what is before or after. The case however is included in the evaluation and therefore a force to upper or lower case should be done with the InStr call. So only 1 check needs to be done using InStr as long as both input and pattern are in the same case.
Yes I understand that, But notice the Integer value "If > 0" meaning that if any of the search patterns are found it will bounce/kick/red ect... Reason for the 4 checks is because if it was plain "asshole" as bad word and someones nickname was "ImAaSShOle" <--- For example it would bounce this person no matter what because you are ONLY looking for word "asshole" so you need to look for the word by self example " asshole " and then look for the word as being the first word in the lastline example ">asshole " or last word in last line example "asshole<" so what we are trying to do is NOT look for the Word "asshole" but look for the word in how it might be used otherwise it might bounce people with that word in there nicknames or sub word of a word. So if any of these matches are found the integer value becomes greater than 0 which mean bounce them.
Sorry if this makes no sense at all to you, It makes perfect sense in my twisted way of thinking im just sorry I couldn't explain it better.
Now for second part of my example, Use a case statement to determine if the bot should bounce/kick/reddot the user...
if iFound <> 0 then
begin
case Integer(lbWords.Items.Objects[iLoop]) of
0: RedDotNick(sNickname);
1: BounceNick(sNickname);
end;
The case Statement will only get executed if the pattern matches(what I described above). Basically for each item in the list I have set a "Tag" or knowen in Delphi as Object ID which when adding the "BadWord" to the list it also added "Tag" to that word in this case if the tag was 0 it would reddot the user or if I had set it 1 when adding the "bad word" it would bounce the user. This removes the need for multiple checks and multiple lists. Also in theory should speed up your code because we are using "case of" statement instead of "if then" and not to mention it will only need to search through 1 list not half a dozen. Hope this help you loco.
Just another Idea, in your "bad word" list you could assign a image 1 image for bounce and another for reddot, when checking the list check what image is used and based upon the image used you will know if you should reddot the user or bounce the user. Also would cool to see little images instead of heaps of different lists
P.s
@AutoPilot
Nice to see your still around mate, Long time since we talked, Hope to catch up with you soon