mIRC Home    About    Download    Register    News    Help

Print Thread
S
Shadow
Shadow
S
Hey there, so all I basically need my script to do is reply to someone when they say a certain word (which would be a swear word which gets filtered out by badwords and replaced with [...]) but the problem is because the replacement uses symbols, the script does not recognise the '[...]' as written text.

Code:
on $*:text:/[...]/i:#:{
  msg $chan Please refrain from using that type of language in here!
}

Joined: Jan 2004
Posts: 1,330
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,330
You're saying you already have a script doing this?

Joined: Jul 2007
Posts: 1,124
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,124
Aren't you aware that you can't really "filter out" the bad words? They'll still be seen by other people BUT yourself, meaning the replaced text is viewable to you only.

To fully censor the bad words on people's ends is to have the chat server program the censorship to begin with.

Having said that, the proper text event is this:
Code:
on ^$*:text:/\[\.{3}\]/iS:#:{
The ^ tells mIRC this is a custom text event. (the halt or haltdef should follow to halt the default) The /S modifier is to strip color control codes if used. This ensures the integrity of the match as colors can get in the way of making it unrecognizable. The .{3} is equivalent to three dots shown in your code.

Since you're already using regex text event, you should escape them using the backward slash so the regex engine can interpret them correctly. In regex, [ ] and ... (dots) have special meanings on their own.

D
Deega
Deega
D
Probably better for readability to use a \Q..\E escape sequence.
Code:
on $*:text:/(\Q[...]\E)/S:#:{


Link Copied to Clipboard