mIRC Home    About    Download    Register    News    Help

Print Thread
#163542 01/11/06 07:16 AM
Joined: Apr 2005
Posts: 1,009
raZOR Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Apr 2005
Posts: 1,009
im makeing auth dialog for script
so naturaly i dont want numbers to be allowed to start with
in usernames
problem is that mirc doesnt get that

if (1sometext isnum) { bla }
contains number :S

so any other solution to this (just not isalpha, coz nicnames can and do use numbers, but not in beginning)

?

Last edited by raZOR; 01/11/06 07:16 AM.

IceCapped
#163543 01/11/06 09:07 AM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Why not use $left with isnum?

if $left(nick,1) isnum { do this }
else { do something else }

That will check if the first character in the nick is a number or not. The characters that are recognized as numbers are the numbers 0 - 9, and the decimal (aka period/dot).
If there are others, then I don't recall them at the moment, or I haven't come across a situation where they've been detected.

#163544 01/11/06 10:09 AM
Joined: Oct 2006
Posts: 166
B
Vogon poet
Offline
Vogon poet
B
Joined: Oct 2006
Posts: 166
if $xor($regex(nick,/^\d/),0) { :tongue:


Kind Regards, blink
#163545 01/11/06 01:42 PM
Joined: Apr 2005
Posts: 1,009
raZOR Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Apr 2005
Posts: 1,009
ahh thanks hehe
forgot mirc has left anf right :S


IceCapped
#163546 01/11/06 01:44 PM
Joined: Apr 2005
Posts: 1,009
raZOR Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Apr 2005
Posts: 1,009
b1nk no offece, i would use yours, but since i dont understand regex i tend to always use simpler code that
is unedrstandable to me.

thanks for effort too !


IceCapped
#163547 01/11/06 03:22 PM
Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
mIRC has a !not operator in if-statements.

if (!$regex(nick,/^\d/)) {

-genius_at_work

#163548 01/11/06 10:14 PM
Joined: Apr 2004
Posts: 759
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Apr 2004
Posts: 759
or to save 1 more byte:
if ($regex($nick,/^\D/)) echo -a nickname doesn't start with a number


$maybe
#163549 01/11/06 10:50 PM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
or to save 7 more bytes:
if ($calc($nick)) echo -a nickname doesn't start with a number

:-) (this is actually faulty but hey i was just being smart.)

Last edited by DaveC; 01/11/06 10:51 PM.
#163550 02/11/06 04:16 AM
Joined: Feb 2006
Posts: 546
J
Fjord artisan
Offline
Fjord artisan
J
Joined: Feb 2006
Posts: 546
you mean nickname DOES start with a number? :P fails with 0 though, $calc(0nick) = $calc(nick) = 0

good thinking though, in fact you could shorten it further with $or(nick) which would have the same effect as $calc(nick) and mess up with 0 laugh


"The only excuse for making a useless script is that one admires it intensely" - Oscar Wilde
#163551 02/11/06 01:15 PM
Joined: Apr 2004
Posts: 759
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Apr 2004
Posts: 759
Likewise:
$r(1,$nick) Will return $null if $nick doesn't start with a number but fail with 0nick :tongue:.


$maybe

Link Copied to Clipboard