I've been doing an overhaul of one of my companions leveling scripts, and I noticed that all of the values are called as shorts in the script (it's modified from Grumpy's Companion 1.1). Now, some of the calculations involve multiplication, so the results are going to have decimals. So, what happens to the short variable? Does it truncate the number to the nearest whole number, or does it skip the decimal place (like a long does) and turn it into a huge number?
I know for certain that it rounds when converting from a float to a short using `set x to y`. I am not sure how it rounds it although I
think it is the nearest integer. Don't take that as fact though.
long lfloat f;...set l to f ;rounds
Regarding what happens when using functions, I don't know. I seem to remember that you got very strange results with using either setPos or position with short arguments. I am not sure why it occurred and it could have been that the value I was trying to represent was too large to fit into a short (quite possible).
Another question I have is whether or not skills and attributes will even take a float variable. I know in MWSE, xGetBasWil for example, returns the base willpower of the npc, and it's called as a float. If you call it as a long, it returns an extremely huge number and messes up the script (it compiles fine, but you don't get exactly what you're expecting if you're running the script).
It
may be because MWSE treats the long as a float. C and C++ allow you to treat one type as another type. It is possible to treat a block of memory holding a long as a float and due to the format differences you will end up with strange number.