Wow, thanks for sharing your code!
One of the things I love about OptoStuff is how there are many ways to solve a particular problem, and not necessarily a “right” answer. I always encourage people to write a little more code if that is easier to understand than some fancy shorthand that may give you a headache.
For example, on your first IntegerToHex logic, I’d do it a little differently, then again, I’m kind of a nerd. Here’s what seemed intuitive to me when I needed to do similar conversions in the past (this is leveraging some OptoScript shorthand you might not have used before).
Basically it boils down to 4 bytes you want to pull out of the 4-byte int32 and stack up as a “string,” which you could do this way (also showing the reverse here in OptoScript):

I’m just using the OptoScript << and >> (bit shift) vs. your Power function, and the shorthand of the [char number] vs. GetNthCharacter but same idea. Hope it makes sense.
There’s one other method that pops in my head which I’ll share here in a bit if I can get it working…