mIRC Home    About    Download    Register    News    Help

Print Thread
#247756 25/08/14 12:34 PM
Joined: Mar 2014
Posts: 42
S
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Mar 2014
Posts: 42
On Twitch.TV, strong language may be filtered and will show up as 3 asterisks (***) in the chat.
for cursing that is not filtered i use 'if (*curseword* iswm $1-)' to check for bad words and purge them from the chat.
Now i wanted to know if i can use something similar to check for 3 asterisks? since 'if (***** iswm $1-)' will obviously not work :P

Help would be highly appreciated smile

Last edited by Sjoepele; 25/08/14 01:01 PM.
Joined: Dec 2008
Posts: 1,515
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,515
Try $chr(42) in the if brackets ..


Need Online mIRC help or an mIRC Scripting Freelancer? -> https://irc.chathub.org <-
Joined: Mar 2014
Posts: 42
S
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Mar 2014
Posts: 42
Aw man i was sure that was going to work but it doesnt seem to hmmmm. Oh well, thanks for the input!

Joined: Jul 2006
Posts: 4,164
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,164
What did you use? if ($+(*,$str($chr(42),3),*) iswm $1-) should work


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Aug 2013
Posts: 81
I
Babel fish
Offline
Babel fish
I
Joined: Aug 2013
Posts: 81
Unfortunately, escaping wildcard characters with their $chr() equivalents won't work, as mIRC will still treat them as wildcards when making a wildmatch comparison. In order to check for them in a string, you'll need to use them in a context where they are not treated as wildcard characters.

In your particular case, since you already appear to be checking if the string occurs anywhere in the line, regardless of what's around it, the isin operator may be a good choice:

Code:
if (*** isin $1-) { ... }


You could also use regex if you want the matching requirements to be highly flexible. (Just keep in mind that you'll need to escape the * and ? characters (in the regex sense) so that they are not treated as meta characters:

Code:
if ($regex($1-,\Q***\E)) { ... }

; or for an example showing more flexibility...
if ($regex($1-,\b\Q***\E\b)) { ... }


There are, of course, also things like $istok() and == for checking whether such chacters are in (or make up) the string; it all depends on your particular need.

Joined: Jul 2006
Posts: 4,164
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,164
Good point, I must have thought it would work because I wanted it to work


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Mar 2014
Posts: 42
S
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Mar 2014
Posts: 42
Thank you very much for your input guys, i'll be sure to check it tomorrow morning. Highly appreciated smile

Joined: Mar 2014
Posts: 42
S
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Mar 2014
Posts: 42
yup, worked perfectly! Thanks again smile


Link Copied to Clipboard