mIRC Homepage
Posted By: raZOR chars in editor and input - 04/07/06 02:47 PM
simple part of example of my antispam scriptie

Code:
  
...
var %input = $input(Channel:,de,Input Request)
 if (#* !iswm %input) || ($chr(38)* !iswm %input) { .echo -a %input invalid channel name | halt }


what annoys me that even in input event, mirc doesnt reckognise & char but takes it as underline.

and another annoyance is that for same situation you cant
use $chr(35) instead #

Code:
  
//if ($chr(35)* !iswm %var) || ($chr(38)* !iswm %var) { .echo -a invalid channel format } | else { .echo -a good chanel format }


well there may be purpose of restricting this
but ah well... i post it anyway as bug thing :P
Posted By: qwerty Re: chars in editor and input - 04/07/06 02:59 PM
I don't know what you're talking about, the code you posted doesn't demonstrate any bug. One thing I noticed though is that you have a syntax error: $chr(38)* should be $chr(38) $+ *. The same applies to $chr(35). Maybe this is the source of your problem?
Posted By: raZOR Re: chars in editor and input - 04/07/06 03:10 PM
i get same error with your code
Posted By: starbucks_mafia Re: chars in editor and input - 04/07/06 08:02 PM
What do you mean by "takes it as underline"?

Your code has syntax errors as qwerty said, and will always match %input as a valid channel name because it's essentially checking if (& !iswm %input) ... which will always be true if %input is a single word (& is the wildcard for a whole word).

Quite aside from all the bug/syntax talk, you probably want to be using $chantypes to check for a valid channel instead of hard-coding the #& prefixes.
ie.
Code:
if ($left(%input,1) !isin $chantypes) echo -a %input invalid channel name
Posted By: qwerty Re: chars in editor and input - 04/07/06 08:20 PM
Right, the fact that & works in iswm didn't come to mind. It might be worth mentioning here that mIRC is smart enough to not treat the & in &* as a wildcard. Of course what you suggested is the best method for this check.
© mIRC Discussion Forums