mIRC Home    About    Download    Register    News    Help

Topic Options
#152665 - 04/07/06 03:47 PM chars in editor and input
raZOR Offline
Hoopy frood

Registered: 06/04/05
Posts: 1009
Loc: Green Hill Zone
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
_________________________
IceCapped

Top
#152666 - 04/07/06 03:59 PM Re: chars in editor and input
qwerty Offline
Hoopy frood

Registered: 07/01/03
Posts: 2523
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?
_________________________
/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com

Top
#152667 - 04/07/06 04:10 PM Re: chars in editor and input
raZOR Offline
Hoopy frood

Registered: 06/04/05
Posts: 1009
Loc: Green Hill Zone
i get same error with your code
_________________________
IceCapped

Top
#152668 - 04/07/06 09:02 PM Re: chars in editor and input
starbucks_mafia Offline
Hoopy frood

Registered: 09/12/02
Posts: 2962
Loc: Norwich, UK
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
_________________________
Spelling mistakes, grammatical errors, and stupid comments are intentional.

Top
#152669 - 04/07/06 09:20 PM Re: chars in editor and input
qwerty Offline
Hoopy frood

Registered: 07/01/03
Posts: 2523
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.
_________________________
/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com

Top