mIRC Home    About    Download    Register    News    Help

Print Thread
Check for asterisk symbols #247756 25/08/14 12:34 PM
Joined: Mar 2014
Posts: 42
S
Sjoepele Offline OP
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.
Re: Check for asterisk symbols [Re: Sjoepele] #247761 25/08/14 04:28 PM
Joined: Dec 2008
Posts: 1,511
westor Offline
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,511
Try $chr(42) in the if brackets ..


Need Online mIRC help or an mIRC Scripting Freelancer? -> http://westor.ucoz.com/contact <-
Re: Check for asterisk symbols [Re: westor] #247764 25/08/14 05:19 PM
Joined: Mar 2014
Posts: 42
S
Sjoepele Offline OP
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!

Re: Check for asterisk symbols [Re: Sjoepele] #247770 25/08/14 06:42 PM
Joined: Jul 2006
Posts: 3,755
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,755
What did you use? if ($+(*,$str($chr(42),3),*) iswm $1-) should work


Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: Check for asterisk symbols [Re: Wims] #247775 25/08/14 08:55 PM
Joined: Aug 2013
Posts: 73
Iire Offline
Babel fish
Offline
Babel fish
Joined: Aug 2013
Posts: 73
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.

Re: Check for asterisk symbols [Re: Iire] #247776 25/08/14 09:43 PM
Joined: Jul 2006
Posts: 3,755
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,755
Good point, I must have thought it would work because I wanted it to work


Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: Check for asterisk symbols [Re: Iire] #247777 26/08/14 01:49 AM
Joined: Mar 2014
Posts: 42
S
Sjoepele Offline OP
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

Re: Check for asterisk symbols [Re: Sjoepele] #247790 26/08/14 05:11 PM
Joined: Mar 2014
Posts: 42
S
Sjoepele Offline OP
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Mar 2014
Posts: 42
yup, worked perfectly! Thanks again smile