mIRC Home    About    Download    Register    News    Help

Print Thread
/bset &bvar -1 1245 1245 1245 1245 doesn't work #268850 09/05/21 01:21 PM
Joined: Jan 2009
Posts: 21
I
Imk0tter Offline OP
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..

Re: /bset &bvar -1 1245 1245 1245 1245 doesn't work [Re: Imk0tter] #268857 09/05/21 09:43 PM
Joined: Jul 2006
Posts: 3,774
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,774
/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.


Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: /bset &bvar -1 1245 1245 1245 1245 doesn't work [Re: Wims] #268865 10/05/21 09:13 AM
Joined: Dec 2002
Posts: 4,936
Khaled Offline
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 4,936
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.

Re: /bset &bvar -1 1245 1245 1245 1245 doesn't work [Re: Khaled] #268866 10/05/21 09:59 AM
Joined: Jan 2004
Posts: 1,585
maroon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,585
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-)

Re: /bset &bvar -1 1245 1245 1245 1245 doesn't work [Re: Khaled] #268868 10/05/21 11:14 AM
Joined: Jul 2006
Posts: 3,774
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,774
I personally don't mind the behavior, it's an extra, it doesn't prevent anyone from using /bset correctly.


Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net