Try this:
//var %tmp = $base(-1,2,10,8) | echo : %tmp
It returns
set -l %tmp $base(-1,2,10,8)-00000001 It seems that in v5.91 works fine.
Seems like a bug, however I can tell why it most likely happens. I'm guessing /var just doesn't work outside of an alias/event. Because if you change the /var to a /set it then works fine.
Yea that was discussed on another thread, apparently /var internally evaluates to /set -l
It's not hard to see that /var works just fine in the command line: //var %a = 5 | echo - s $calc(5 + %a)
The problem is indeed with $base(): when negative numbers are used AND the <zeropad> parameter is specified, weird things happen. Probably somebody forgot to clear a buffer or something. Examples:
//set %a hello | echo -s $base(-5,10,4) -> works normally
//set %a hello | echo -s $base(5,10,4,7) -> works normally
//set %a hello | echo -s $base(-5,10,4,7) -> returns the correct result, but prefixed with the value of %a
Try evaluating it from an input box using the TAB key; when I tried, I got some VERY odd text at the beginning (the titlebar text with the first 8 bytes chewed up).
I don't have either of these problems in mIRC 6.00. Yet another reason why I wont upgrade.
//var %tmp = $base(-1,2,10,8) | echo -a %tmp
000000-1
//set %a hello | echo -a $base(-5,10,4,7)
0000-11
Yes, the negative should appear before the padding... but there don't appear to be any buffer issues with /var /set -l, etc.
- Raccoon