Try
Stri(int) in one direction and then
val(str, 10) in the other.
(Yes, the val
with second argument.)
Hex colors with R>127 are negative int-s - that's ok as long as conversion to and fro is faithful.
PS. a quick&dirty check (besides
discovering a bug in loops) seems to confirm the combo working:
BrightScript Debugger> for v = -2^31 to 2^31-258 step 257: check = v=val(stri(v), 10) or 0/0: next
BrightScript Debugger> REM: no "divide by zero" error
As illustration to what happens to big ints when they go through floats:
BrightScript Debugger> b = &h7ffffeff
BrightScript Debugger> ? b = int(b)
false
BrightScript Debugger> ? type(b), b, int(b), cint(b)
Integer 2147483391 2147483392 2147483392