mIRC Home    About    Download    Register    News    Help

Print Thread
Support base-16 in $chr() #221107 07/05/10 09:31 PM
Joined: Oct 2003
Posts: 3,918
A
argv0 Offline OP
Hoopy frood
OP Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
Now that mIRC can represent $chr() values > 256 (Unicode codepoints) it would be a lot simpler and less confusing if those values could be represented in base-16, as this is the standard representation for Unicode codepoints (U+nnnn).

The following syntaxes would be beneficial to users:

//echo -a $chr(0x0E03)
//echo -a $chr(U+0E03)

The latter syntax being the standard Unicode codepoint notation. This would make it easier for users to copy paste these codepoints out of programs like charmap.exe and websites like these.


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Re: Support base-16 in $chr() [Re: argv0] #221110 07/05/10 10:04 PM
Joined: Apr 2010
Posts: 924
F
FroggieDaFrog Offline
Hoopy frood
Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 924
$char($base(#,16,10)) ^.^


I am SReject
My Stuff
Re: Support base-16 in $chr() [Re: FroggieDaFrog] #221111 07/05/10 10:09 PM
Joined: Oct 2003
Posts: 3,918
A
argv0 Offline OP
Hoopy frood
OP Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
Knowing when to and when not to do base conversion is the problem.

Most users would assume: U+0155 == $chr(155). They would be wrong.

This is actually further muddled by the fact that Windows Alt+NNNN codes are represented in base10 but U+NNNN codes are base16.

So a user might think Alt+0155 == U+0155. They would be wrong about that too.


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Re: Support base-16 in $chr() [Re: argv0] #221121 07/05/10 10:55 PM
Joined: Apr 2010
Posts: 924
F
FroggieDaFrog Offline
Hoopy frood
Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 924
yea. But those fooling around with unicode generally know that alt+155 != U+0155 -shrugs- I do see where u are coming from, but instead of having $chr(u...) have $uchr(...)


I am SReject
My Stuff
Re: Support base-16 in $chr() [Re: argv0] #221122 07/05/10 10:57 PM
Joined: Jan 2003
Posts: 2,523
Q
qwerty Offline
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
Agreed, that would be very handy.


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Re: Support base-16 in $chr() [Re: argv0] #221149 08/05/10 09:39 PM
Joined: Jan 2009
Posts: 116
Knoeki Offline
Vogon poet
Offline
Vogon poet
Joined: Jan 2009
Posts: 116
Sounds like a good idea to me, argv0's syntax seems sensible, although perhaps a seperate identifier like $uchr() could be nice. Either way, I'd love to see it being added! :_)


http://zowb.net

/server -m irc.p2p-network.net -j #zomgwtfbbq
(ssl on port 6697 and 7000)
Re: Support base-16 in $chr() [Re: argv0] #221157 08/05/10 11:27 PM
Joined: Oct 2004
Posts: 8,327
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,327
Guess adding this would mean I have to again edit a script so it uses a different format since I'm using it as $chr(NNNN) for the unicode character. frown


Invision Support
#Invision on irc.irchighway.net
Re: Support base-16 in $chr() [Re: Riamus2] #221165 09/05/10 05:29 AM
Joined: Dec 2002
Posts: 339
D
drum Offline
Fjord artisan
Offline
Fjord artisan
D
Joined: Dec 2002
Posts: 339
Originally Posted By: Riamus2
Guess adding this would mean I have to again edit a script so it uses a different format since I'm using it as $chr(NNNN) for the unicode character. frown


No, it wouldn't break existing scripts. I believe this was the idea:

$chr(NNNN) --> treat NNNN as base 10 value
$chr(0xNNNN) --> treat NNNN as base 16 value
$chr(U+NNNN) --> treat NNNN as base 16 value

Re: Support base-16 in $chr() [Re: argv0] #222746 01/07/10 07:36 PM
Joined: Jul 2006
Posts: 248
B
bwuser Offline
Fjord artisan
Offline
Fjord artisan
B
Joined: Jul 2006
Posts: 248
Do not agree. Unicode notation is hexadecimal while mirc operates with decimal numbers. Its pretty logical to have a scripter to convert before feeding to $chr()

Re: Support base-16 in $chr() [Re: bwuser] #222747 01/07/10 07:40 PM
Joined: Dec 2002
Posts: 2,962
S
starbucks_mafia Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
Quote:
Unicode notation is hexadecimal while mirc operates with decimal numbers

Hence the suggestion.


Quote:
Its pretty logical to have a scripter to convert before feeding to $chr()

Is it? It makes far more sense to me for scripts (and therefore scripters) to use codepoints in their most common form to make it easier for anyone reading the code to recognise which characters are being represented.


Spelling mistakes, grammatical errors, and stupid comments are intentional.
Re: Support base-16 in $chr() [Re: starbucks_mafia] #222752 01/07/10 08:22 PM
Joined: Jul 2006
Posts: 248
B
bwuser Offline
Fjord artisan
Offline
Fjord artisan
B
Joined: Jul 2006
Posts: 248
Originally Posted By: starbucks_mafia
Quote:
Its pretty logical to have a scripter to convert before feeding to $chr()

Is it? It makes far more sense to me for scripts (and therefore scripters)

Hell is other scripters - Sartre. ;-)

In my personal opinion suggested way will add more confusion than benefit.

Re: Support base-16 in $chr() [Re: bwuser] #222781 02/07/10 09:10 PM
Joined: Sep 2005
Posts: 2,878
H
hixxy Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,878
Where's the confusion? $chr() will work exactly as it always has, but there will now be a shorthand way of working with hexadecimal numbers.

It's extremely simple really:

$chr(<number>) if you want to use decimal.
$chr(0x<number>) or $chr(U+<number>) if you want to use hexadecimal.