mIRC Home    About    Download    Register    News    Help

Print Thread
#78353 07/04/04 03:53 PM
Joined: Jan 2004
Posts: 129
A
AaronL Offline OP
Vogon poet
OP Offline
Vogon poet
A
Joined: Jan 2004
Posts: 129
Hi all.
i use this to kick on bad language:

on @1:text:*:#: {
set %i 0
:checking
inc %i 1
set %currentsword $read -l $+ %i $mircdirtxtfiles\swear.txt
if (%currentsword == $null) { .unset %i | goto end }
else {
if (%currentsword isin $1-) { goto offense }
else { goto checking }
}
blushffense
if ($nick !isop $chan) { /swearkick }
.goto end
:end
}
Now, lets say the bad word is 'opera'. then the bot will kick.
but it also kicks on 'stopera'. wich is a opera building in the Netherlands.
How can i make the bot to kick only the 'opera' and not the 'stopera'. and other words ofcourse smile

With greetings
aaron


Deridio fatum
Joined: Jun 2003
Posts: 5,024
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Jun 2003
Posts: 5,024
Simple way:

if (%currentsword == $null) { .unset %i | goto end }
if (stopera isin $1) { halt }
else {

Add the red line, that will stop (halt) the script if "stopera" is said. This also means "opera and stopera" will not activate the script though, so if they say "opera" and "stopera" in the same sentence, they will not be kicked. If "stopera" is nowhere in their text though, /swearkick will be activated

Regards,


Mentality/Chris
Joined: Jan 2004
Posts: 129
A
AaronL Offline OP
Vogon poet
OP Offline
Vogon poet
A
Joined: Jan 2004
Posts: 129
smile that wasn't what i ment.
example: i have a list with all the bad words.
(i don't use real badwords here)
if a bad word is mayo
then when people type mayor or mayonaise or.. they get kicked because of the word mayo in it.
and since there are more of that kind of words, i cannot know wich word they gonna use.
your solution is good but not suitable for me. Perhaps another solution?

Greetings
Aaron


Deridio fatum
Joined: Feb 2003
Posts: 3,432
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
Code:
on *:text:*:#:{
  if ( $me !isop $chan ) { halt }
  if (%word.kick == on) {
    set %badword.line 1
    :badword
    if ( $read -l $+ %badword.line $mircdir\file_name == $null ) { halt }
    elseif ( $read -l $+ %badword.line $mircdir\file_name isin $1- ) { goto badwordkick }
    else { inc %badword.line | goto badword }
    :badwordkick
    if (%ban.bad.word == on) ban -u [ $+ [ %bad-word-ban ] ] $chan $nick
    kick # $nick kick message
    else { halt }
    :end
  }
}

maybe this is what you want? remember to change the lines

$mircdir\file_name that line in this code..

if you want it to ban, set %ban.bad.word on else set it off... to set the time for how long the ban should last, use set %bad-word-ban, set it to 60 would give a ban for 1 minute. to disable the script.. set %word.kick off ... and to enable it set it on..


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Joined: Jun 2003
Posts: 5,024
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Jun 2003
Posts: 5,024
whoops, apologies! I hope the above helps, sorry for the misinterpretation!

Regards,


Mentality/Chris
Joined: Jan 2004
Posts: 129
A
AaronL Offline OP
Vogon poet
OP Offline
Vogon poet
A
Joined: Jan 2004
Posts: 129
hi Sparta.
i copy/paste your code, but with thesame result, an unwanted kick. confused
i dit put the word opera in de badword list and tryd different aproaches, like
stOPERA / OPERAan / OPERAline / krOPERAn and whatever people type there.
thoose words are not allowed to kick, just the word OPERA.

Greetings
Aaron


Deridio fatum
Joined: Feb 2003
Posts: 3,432
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
maybe somone else know how to filter it out the easyest way.. been working 12 h now.. so im a bit tired and cant think stright.. but you can edit the code ur self..

elseif ( $read -l $+ %badword.line $mircdir\file_name isin $1- ) { goto badwordkick }

remove the - sign from $1- , then it only kick if the first word is opera.. $2 the seccond word .. $3 the 3'd word and so on.. good night..


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Joined: Jan 2004
Posts: 129
A
AaronL Offline OP
Vogon poet
OP Offline
Vogon poet
A
Joined: Jan 2004
Posts: 129
have a good rest smile

but that's not what i ment.
people type this:
stOPERA - OPERAtional - kaliOPERAbe - OPERAtion - bridgeOPERA etc. etc. The bot is not allowed to kick thoose words or whatever people type.
Only if people type OPERA they need to be kicked.

bytheway: i use OPERA as an example.. smile

Greetings
Aaron

Last edited by AaronL; 08/04/04 05:14 PM.

Deridio fatum
Joined: Feb 2004
Posts: 33
M
Ameglian cow
Offline
Ameglian cow
M
Joined: Feb 2004
Posts: 33
This should work. Put the bad words instead of "bad, words, seperated..." and it should work. I tested it. You can also change the reason as well. Change anything else, and it won't work.
Code:
on *:TEXT:*:#: {
  set %badwords bad, words, seperated, by, commas
  set %si 0
  :loopin
  inc %si 1
  if ($gettok(%badwords,%si,44) == $null) { goto loopout } 
  if ($gettok(%badwords,%si,44) isin $1-) { //kick $chan $nick No Bad Words!!! }
  goto loopin
  :loopout
}


There you go!


Adrenaline starts to flow, thrashing all around, acting like a maniac, WHIPLASH!!!
Joined: Feb 2004
Posts: 21
D
Ameglian cow
Offline
Ameglian cow
D
Joined: Feb 2004
Posts: 21
Here's my suggestion. Use %variable for badword list instead of file.

Code:
[color:red]set %bad_word_list badword1 badword2 badword3 [and so on] [/color] 
on @*:text:*:#: {
  var %i = $numtok(%bad_word_list,32)
  while (%i) {
    if ($istok($1-,$gettok(%bad_word_list,%i,32),32)) {
      kick $chan $nick No swearing allowed on $chan
      halt
    }
    dec %i
  }
}

You can manually enter variable %bad_word_list to script editor's variable section and remove red part from my script. If you don't want this event to trigger on every channel you have ops, you should specify channels like this:

on @*:text:*:#chan1,#chan2,#chan3: { Rest of the script }

Last edited by Derethil; 08/04/04 06:18 PM.
Joined: Jan 2004
Posts: 129
A
AaronL Offline OP
Vogon poet
OP Offline
Vogon poet
A
Joined: Jan 2004
Posts: 129
Thank you so much Derethil.

your code works great. smile and learned me something about istok and gettok.

and ofcourse thank you to all who reply'd to my question.

appriciated
Aaron

Last edited by AaronL; 08/04/04 08:42 PM.

Deridio fatum
Joined: Apr 2004
Posts: 10
M
mok Offline
Pikka bird
Offline
Pikka bird
M
Joined: Apr 2004
Posts: 10
Hi there,

I was trying out the code and it works great. I was just wondering if there's anyway to expand it or do a slight change to it, so it'll give the users violating the words a couple more chances before it kicks+ban? For example, if someone said the word "test" it would rather do a /msg in the channel telling them they will have 1 more chance before they get banned for saying another violated word. Just a thought here, but if anyone here will know how to do this addon onto the code that'll be great! Thanks in advance smile

Joined: Feb 2004
Posts: 714
Z
Hoopy frood
Offline
Hoopy frood
Z
Joined: Feb 2004
Posts: 714
Code:
on @+1:TEXT:*:#: {
  if ($nick isin %baduser) {
    var %swearcount = 1
    while ($gettok(%swears,0,44) >= %swearcount) {
      if ($gettok(%swears,%swearcount,44) isin $1-) {
        ban -u300 # $nick 3
        kick # $nick No swearing in here, you were warned before!
      }
      inc %swearcount
    }
  }
  elseif ($nick !isin %baduser) {
    var %swearcount = 1
    while ($gettok(%swears,0,44) >= %swearcount) {
      if ($gettok(%swears,%swearcount,44) isin $1-) {
        .notice $nick You have said a bad word on the channel. If you do that again you'll be punished.
        set %baduser %baduser $+ $chr(44) $+ $nick
        [color:red].timerswear 1 3600 /unset %baduser[/color]
      }
      inc %swearcount 
    }
  }
}


I've included that timer to unset the %baduser variable within 1 hour after its set, but its totally optional.
Also, those variable can be changed.. i just used them because they are already set in my swear kick, so i used them smile

Hope it helps wink


"All we are saying is give peace a chance" -- John Lennon
Joined: Feb 2004
Posts: 21
D
Ameglian cow
Offline
Ameglian cow
D
Joined: Feb 2004
Posts: 21
Here's my shot.

Code:
on @*:text:*:#: {
  ;Next command line skips the "bad word" test if the message was sent by a channel operator.
  ;But why would you allow channel operators swear if anyone else can't?
  if ($nick isop $chan) goto ops_can_swear
  var %i = $numtok(%bad_word_list,32)
  var %address = $address($nick,[color:green]3[/color])
  while (%i) {
    if ($istok($1-,$gettok(%bad_word_list,%i,32),32)) {
      inc %bad_word_counter_ [ $+ [ $chan ] $+ ] _ [ $+ [ %address ] ]
      if (%bad_word_counter_ [ $+ [ $chan ] $+ ] _ [ $+ [ %address ] ] == 1) {
        notice $nick Swearing is not allowed on $chan $+ .
        break
      }
      if (%bad_word_counter_ [ $+ [ $chan ] $+ ] _ [ $+ [ %address ] ] == 2) {
        notice $nick I have said already, swearing IS NOT allowed on $chan $+ !
        notice $nick For now you have been silenced for 15 minutes.
        notice $nick Next time you'll be kicked and banned from $chan $+ .
        mode $chan -v $nick
        ban -u[color:blue]900[/color] $chan $nick [color:green]3[/color]
        break
      }
      if (%bad_word_counter_ [ $+ [ $chan ] $+ ] _ [ $+ [ %address ] ] >= 3) {
        ban -u[color:red]36000[/color] $chan $nick [color:green]3[/color]
        .timer 1 3 kick $chan $nick Ok, still swearing. You're going out!
        %bad_word_counter_ [ $+ [ $chan ] $+ ] _ [ $+ [ %address ] ] = 1
        break
      }
    }
    dec %i
  }
  :ops_can_swear ;Which is unfair, don't you think?
}


Remember to set bad word variable:
/set %bad_word_list badword1 badword2 badword3 [and so on]

The logic of the script is this:
1) First message containing a "bad word": User gets warning notice.
2) Second message containing a "bad word": User gets warning and is banned (but not kicked) for 15 minutes (900 seconds). This means user can stay on the #channel but can't send any messages within 15 minutes time. If user decides to leave, he/she can't rejoin within 15 minutes. User is also devoiced (-v) because the possible voice mode (+v) overrides ban.
3) Third message containing a "bad word": User gets banned from #channel for 10 hours (36000 seconds). If the same user comes in after that 10 hour period and uses "bad words" again, he/she gets silenced for 15 minutes right away (no first warning).

This script is channel-specific, so user may get banned from one channel you have ops but can still speak on another (until gets banned from there too smile ). In "bad word counter" I used user's address in form
"*!*user@*.address.net". This means user can even change his/her nick without counter being fooled. You can change the address mask by changing the green numbers up there in the script to something between 0-19 (/help $mask for more info).

I know that similar auto-ban&kick-from-swearing scripts have been posted many times before. This is just how I would like to do this.

Last edited by Derethil; 11/04/04 06:47 AM.
Joined: Apr 2004
Posts: 10
M
mok Offline
Pikka bird
Offline
Pikka bird
M
Joined: Apr 2004
Posts: 10
wow, first of all thank you you guys for replying me with such great examples. I tried them both and both of them works great. Ok, but here's another problem that came up to me. I understand that this script was suppose to kick people who's actually swearing. So therefore, the variables that were set in there has to be the swear words. I wanted to add "#" in the variable of the words as I wanted to count the # sign when ppl tries to advertise their channel. Basically, I am just adding it in the variable to reconize it as a swearing word, so it'll do it's task. I have been trying, but the script doesn't seems to reconize "#test" when i try to type a channel name including the "#" Is there are reason why that the script is not reading the "#" when i try to post a channel name? Is there a way to make the script also just reconize "#" within anything will also count as a swearing? I am just trying to put the swearing and advertising together into one script, using this one. Is that possible? Any help will be much appreciated. Thanks!

Joined: Feb 2004
Posts: 21
D
Ameglian cow
Offline
Ameglian cow
D
Joined: Feb 2004
Posts: 21
mok: It's because AaronL originally asked for script that checks only complete words. If you want my script to work with "bad words" that are linked to other words, replace the line:

if ($istok($1-,$gettok(%bad_word_list,%i,32),32)) {

with this:

if ($gettok(%bad_word_list,%i,32) isin $1-) {

Now you can have # in the %bad_word_list and it'll be handled as swearing no matter where it appears in the message. Even good guys will get swear warnings if they happen to have # somewhere.

This kind of automatic tests cannot be 100 % reliable. If you want every word that even distantly looks like "bad" being count as swearing, it's probable that innocent messages will get counted as well. It is possible to make a script which checks every single word being sent if they match to certain wildcard text (for example *badword* or #???abcd* ...) but it takes time to run such tests and mIRC might slow down seriously (at least on my VERY old computer).

If you're interested in developing more accurate word tests, try counting how many words there are in the message by $numtok($1-,32) and looping (/help /while) a test for every word. In actual test you can use ISWM operator instead of ISIN and it'll allow you to use wildcard words in %bad_word_list variable (see "/help if then else" for more info on operators).

Hope this helps.


Link Copied to Clipboard