mIRC Home    About    Download    Register    News    Help

Print Thread
chars in editor and input #152665 04/07/06 02:47 PM
Joined: Apr 2005
Posts: 1,009
raZOR Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Apr 2005
Posts: 1,009
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
Re: chars in editor and input #152666 04/07/06 02:59 PM
Joined: Jan 2003
Posts: 2,523
Q
qwerty Offline
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
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
Re: chars in editor and input #152667 04/07/06 03:10 PM
Joined: Apr 2005
Posts: 1,009
raZOR Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Apr 2005
Posts: 1,009
i get same error with your code


IceCapped
Re: chars in editor and input #152668 04/07/06 08:02 PM
Joined: Dec 2002
Posts: 2,962
S
starbucks_mafia Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
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.
Re: chars in editor and input #152669 04/07/06 08:20 PM
Joined: Jan 2003
Posts: 2,523
Q
qwerty Offline
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
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