mIRC Home    About    Download    Register    News    Help

Print Thread
#41997 15/08/03 09:39 AM
Joined: Aug 2003
Posts: 7
T
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
T
Joined: Aug 2003
Posts: 7
A thing to convert hexadecimal code to decimal.
something like: $hex(0xFF) or $hex(FF) which both will result in 255.
I always wanted such a converter :tongue:

#41998 15/08/03 09:44 AM
Joined: Feb 2003
Posts: 309
C
Fjord artisan
Offline
Fjord artisan
C
Joined: Feb 2003
Posts: 309

$base(N,inbase,outbase,zeropad,precision)
Converts number N from inbase to outbase. The last two parameters are optional.

$base(15,10,16) returns F
$base(1.5,10,16) returns 1.8
$base(2,10,16,3) returns 002


#41999 15/08/03 09:47 AM
Joined: Aug 2003
Posts: 7
T
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
T
Joined: Aug 2003
Posts: 7
Wouldn't a $hex() be much more simple then that $base() thing :\ ?
Thanks anywayz, ill investigate that $base thing :tongue:

#42000 15/08/03 10:06 AM
Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
No, it wouldn't. You want $hex(), I want $octal(), $bin(), $whateverbaseyoumightthinkof(). Do you think they should be implemented? If you really need $hex() nothing stops you from using
Code:
alias hex return $base($remove($1,0x),16,10)


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
#42001 16/08/03 04:50 PM
Joined: Dec 2002
Posts: 117
R
Vogon poet
Offline
Vogon poet
R
Joined: Dec 2002
Posts: 117
$base(1.5,10,16) returns 1 for me...


$input(Me like stars, You too?)
#42002 16/08/03 04:56 PM
Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
$base is broken when you deal with decimals. He was just pasting from the helpfile.

#42003 17/08/03 12:10 AM
Joined: Feb 2003
Posts: 309
C
Fjord artisan
Offline
Fjord artisan
C
Joined: Feb 2003
Posts: 309
*points out that it's a bit odd to use a DECIMAL point in a HEXADECIMAL number*

*rubs his tired eyes and wonders where he will find a hexadecimal point at this time of the morning*
:P

#42004 17/08/03 12:55 AM
Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
Yeah, you're right, the correct term is a hexidecimal point, or sometimes called a hexdec point or a hex point.


Link Copied to Clipboard