mIRC Home    About    Download    Register    News    Help

Print Thread
#143802 01/03/06 11:05 PM
Joined: Jan 2006
Posts: 1
M
Mostly harmless
OP Offline
Mostly harmless
M
Joined: Jan 2006
Posts: 1
How do I make a remote script that kicks and bans people for typing certain WORDS IN CAPS for 10 minutes?

on 1:TEXT:???:#channelname:/ban -ku600 #channelname $nick 2

the ??? is because I don't know how to make the remote script so it only recognize a word that is entirely in caps.

Do I have to use different a different command??

#143803 02/03/06 12:32 AM
Joined: Aug 2005
Posts: 525
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Aug 2005
Posts: 525
Not the greatest way, since the list of words could be arbitrarily large, but it does what you're asking.

Add another word by placing |WORD3 (in captial letters and including the leading pipe character) after WORD2. This is only an example.

Obviously, change #Channel as well.

Also, this will trigger if the words are anywhere in the text.

Using the given example words, it will trigger on any of these:

This is WORD1
This is WORD1!
This isWORD1!
WORD2isABadWord

Code:
on @$*:TEXT:/[color:red]WORD1[/color]|[color:red]WORD2[/color]/S:[color:red]#Channel[/color]:{
  ban -ku600 $chan $nick 2
}

#143804 02/03/06 12:40 AM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Why are you using $() when there are no identifiers/variables to evaluate? You also don't need to make the pattern capturing, as you are not using $regml anywhere, or using backreferences in the regex pattern.


Gone.
#143805 02/03/06 12:46 AM
Joined: Aug 2005
Posts: 525
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Aug 2005
Posts: 525
Just my laziness to remove it. I copied it from another code I was working on at the moment.

I'm not sure what you mean by pattern matching and $regml as I'm not familiar with that identifier.

#143806 02/03/06 12:48 AM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Would be wise to include the S modifier. You are still making the pattern capturing, there's no need as /a|b/ will work as intended, capturing like (a|b) serves no purpose in your expression. However, if you decide to add word boundaries (which you should for less false positives), then it's another story. \ba|b\b then is different from \b(a|b)\b.


Gone.
#143807 02/03/06 12:58 AM
Joined: Aug 2005
Posts: 525
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Aug 2005
Posts: 525
Would you mind explaining what the S modifier is and how it is implemented? My understanding of regex isn't too in depth, yet.

#143808 02/03/06 01:03 AM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
It ignores control chars when trying to match the expression against the input string.

You can compare it with doing if checks on $strip($1-) instead of $1-

Its implementation is the same as all other modifiers. Either you make it a global setting by specifying it after the last regex delimiter (usually / unless the m character was used to specify custom regex delimiters), or you specify it locally somewhere in the regex.

Examples:

/a|b/S <- global, applies to entire expression

/(?S)(?:a|b)/ <- specified locally, with global application as specified at beginning without ending it

/(?S)(?:a|b)(?-S)c/ <- specified locally, only counts for the a|b part, not the c part.


Gone.
#143809 02/03/06 01:08 AM
Joined: Aug 2005
Posts: 525
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Aug 2005
Posts: 525
I see. Thanks for the explanation. I'm slowly catching on to regex.

Another question, what is the meaning of the ? in the explanation? My assumption is that it's a way of denoting a 'tag/closing tag' for lack of a better term.

#143810 02/03/06 01:14 AM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
? has many different meanings in regex, but in my examples the one with the S enclosed denotes the start and/or end like tags indeed. In the last example, the ?: means that the expression following it enclosed in the brackets will not be captured for later reference. /a|b/ is thus the same as /(?:a|b)/


Gone.

Link Copied to Clipboard