mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jan 2009
Posts: 21
I
Ameglian cow
OP Offline
Ameglian cow
I
Joined: Jan 2009
Posts: 21
/bset -t &bvar -1 $chr(1245) $chr(1245) works
/bset &bvar -1 1245 1245 doesn't work..

Joined: Jul 2006
Posts: 4,145
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
/bset without the -t switch accepts byte number only. byte are 0-255 only, which I'm sure you know, so 1245 is not a valid byte number.
However, I checked and you probably should have been a bit clearer about it, executing /bset &bvar -1 1245 result in a binvar containing a single byte 221, which is a bug and I guess what you were reporting, this should be moved back to the bug report section.


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Dec 2002
Posts: 5,412
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 5,412
The /bset command has never checked for valid byte range values. If you specify a value that is outside of the range 0-255, it rolls over. While I could change this now, ie. make it report an error and halt the script, it would break all existing scripts that expect this to work.

Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
While it does roll over so that it stores the lowest 8 bits of the number, it's only doing that for the signed integer range. For 2^31 and above it stores 255, but scripts would be more likely to take advantage of this behavior if it worked at least up to the uint32 max:

//var %i 10 , %val $calc(2^31-5) | while (%i) { bset &v 1 %val | echo -a %val -> $bvar(&v,1) | dec %i | inc %val }

For the negative portion of the signed-int range, it does like it does for other non-numerics, and returns 45 from the hyphen's codepoint:

//bset &v 1 -2 | echo -a $bvar(&v,1-)

Joined: Jul 2006
Posts: 4,145
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
I personally don't mind the behavior, it's an extra, it doesn't prevent anyone from using /bset correctly.


#mircscripting @ irc.swiftirc.net == the best mIRC help channel

Link Copied to Clipboard