mIRC Home    About    Download    Register    News    Help

Topic Options
#265278 - 26/03/19 01:08 PM $asc() returns empty for curly braces { }
gahalle Offline
Nutrimatic drinks dispenser

Registered: 17/12/02
Posts: 9
Using v7.55
`$asc({)` and `$asc(})` returns empty values instead of expected 123 or 125.

Reproduced with
`//echo * $asc({) $asc(})`

Top
#265279 - 26/03/19 02:51 PM Re: $asc() returns empty for curly braces { } [Re: gahalle]
maroon Offline
Hoopy frood

Registered: 12/01/04
Posts: 1151
It happens with numerous string identifiers, and not for just this version.

//echo -a $asc(}) ,
//echo -a $asc({) .
result: 44 46

//echo -a $str({,5)
//echo -a $left(},5)
result: 5
//echo -a $str({,5) anything
//echo -a $left(},5) anything
result: $null

//echo -a $sha1({) abc
//echo -a $sha256(}) abc
result: same as $sha1(abc) or $sha256(abc)
//echo -a $len({) abc
result: 3

workaround is:
//echo -a $asc( $({) ) or $asc( $eval({) )
or
//var %a { | echo -a $asc({}
or the one that assumes you already know the answer
//echo -a $asc($chr(123))

You should not expect this next to be 'fixed', as brackets outside parenthesis shouldn't be used, and from the above it doesn't like them inside anything besides $() $eval():
//var %a = } | echo -a %a
//var %a = { | echo -a %a

Top
#265281 - 26/03/19 04:21 PM Re: $asc() returns empty for curly braces { } [Re: maroon]
gahalle Offline
Nutrimatic drinks dispenser

Registered: 17/12/02
Posts: 9
Thank you for the explanation. I was half expecting brackets to not be featured, but was made uncertain after being able to get an ascii code from doing unexpected inputs with extra characters such as for instance $asc({x).

As for what I need it to do, wrap it in $eval() does look like the way to go around this.

d-(",)z

Top