mIRC Home    About    Download    Register    News    Help

Print Thread
FIND text in string..HOW ? #84869 01/06/04 05:06 PM
Joined: Jun 2003
Posts: 19
S
sahmed01 Offline OP
Pikka bird
OP Offline
Pikka bird
S
Joined: Jun 2003
Posts: 19
Hi

Here is what I have in my script

on *:text:*:*:{
if (penis isin $1-) {
if ($nick !isop # ) {
.kick # $nick Abuse detected | break } }

The problem is that it also kicks whoever types pen. How do I fix it so it compares the whole word in $1-

Thanks in advance

Sahmed01




Re: FIND text in string..HOW ? #84870 01/06/04 06:25 PM
Joined: Mar 2003
Posts: 160
Marantz Offline
Vogon poet
Offline
Vogon poet
Joined: Mar 2003
Posts: 160
on 1:TEXT:penis*:#: if ($me isop $chan) && ($chan == #yourchanhere) { .kick # $nick Abuse detected }

that post made me chuckle a bit grin

Re: FIND text in string..HOW ? #84871 01/06/04 09:13 PM
Joined: May 2004
Posts: 132
N
NoPleX Offline
Vogon poet
Offline
Vogon poet
N
Joined: May 2004
Posts: 132
You can also use this one:

on *:text:*penis*:#:{
if ($me isop $chan) {
kick # $nick Abuse detected
}
}


wink


if ($me != geek) { $life is $false }
else { $life is $true }
NoPleX
Re: FIND text in string..HOW ? #84872 01/06/04 09:24 PM
Joined: Dec 2002
Posts: 124
B
bloupx Offline
Vogon poet
Offline
Vogon poet
B
Joined: Dec 2002
Posts: 124
on *:TEXT:*:#:if ($istok($1-,penis,32)) .raw kick # $nick :abuse detected.

Re: FIND text in string..HOW ? #84873 01/06/04 09:48 PM
Joined: Apr 2003
Posts: 701
K
Kelder Offline
Hoopy frood
Offline
Hoopy frood
K
Joined: Apr 2003
Posts: 701
on @*:TEXT:*penis*:#yourchannel: .kick # $nick Abuse detected

The @ replaces the if ($me isop $chan) and the channel is put in the trigger.

Problem is that there might be some words like blahpenisblah that are ok, and it will kick those too. Using regex:

on $@*:TEXT:m/\Wpenis\W/Si:#yourchannel: .kick # $nick Abuse detected

or for other words also (find a guide on regex)
on $@*:TEXT:m/\W(?:penis|nasty|vagina)\W/Si:#yourchannel: .kick # $nick Abuse detected

Re: FIND text in string..HOW ? #84874 02/06/04 01:50 AM
Joined: May 2004
Posts: 132
N
NoPleX Offline
Vogon poet
Offline
Vogon poet
N
Joined: May 2004
Posts: 132
Just want to notice you Kelder that your script dont wort this way:

penis bla bla

bla bla penis

It only works this way:

bla penis bla


Just wanted to make a notice! Dont know how to fix it sorry


if ($me != geek) { $life is $false }
else { $life is $true }
NoPleX
Re: FIND text in string..HOW ? #84875 02/06/04 09:47 AM
Joined: Apr 2003
Posts: 701
K
Kelder Offline
Hoopy frood
Offline
Hoopy frood
K
Joined: Apr 2003
Posts: 701
blush you're right, \W does not match end or start blush

This should do it...
on $@*:TEXT:m/(?<!\w)penis(?!\w)/Si:#yourchannel: .kick # $nick Abuse detected

For multiple words: replace penis with (?:word1|word2|word3)
If you also want to have the word itself use (word1|word2|word3) and you have the offending word in $regml(1)

Re: FIND text in string..HOW ? #84876 02/06/04 10:21 AM
Joined: Aug 2003
Posts: 1,831
I
Iori Offline
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
Better would be \b (word boundary)
  • on $@*:text:/\bpenis\b/Si:#yourchanhere:kick # $nick Abuse detected!

Re: FIND text in string..HOW ? #84877 02/06/04 10:25 AM
Joined: May 2004
Posts: 132
N
NoPleX Offline
Vogon poet
Offline
Vogon poet
N
Joined: May 2004
Posts: 132
nice Kelder it workes fine now wink


if ($me != geek) { $life is $false }
else { $life is $true }
NoPleX
Re: FIND text in string..HOW ? #84878 02/06/04 10:28 AM
Joined: Aug 2003
Posts: 1,831
I
Iori Offline
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
Well firstly you got it backwards.
if pen isin $1- <- would match if someone typed penis
  • if $istok($1-,<word>,32) { commands }
    where 32 refers to space (ascii character 32)


on @*:text:*:#:{
  • if $nick isop # { return }
    if $istok($strip($1-),penis,32) { kick # $nick Abuse detected }
    elseif $istok($strip($1-),abuse,32) { kick # $nick Abuse detected }
    elseif $istok($strip($1-),more,32) { kick # $nick Abuse detected }
}

Re: FIND text in string..HOW ? #84879 02/06/04 11:23 AM
Joined: Apr 2003
Posts: 701
K
Kelder Offline
Hoopy frood
Offline
Hoopy frood
K
Joined: Apr 2003
Posts: 701
that looks too easy, can't be good :tongue:


OK I'm apparently having some sickness where I completely overlook the obvious stuff frown