PDA

View Full Version : FloatToInt - How exactly does this little number work?


Pavlos
05-05-2006, 02:08 PM
OK... so I have used FloatToInt() several times in my scripts but I was just wondering about the mechanics of it (I don't know whether "mechanics" is the correct term to use here but, meh!)

Seeing as how a Float can be a decimalised number (An example being "GetFacing()") and an Integer has to be... an integer (Surprisingly) I want to know how this actually works out. Is the value rounded to the nearest whole number? Just thinking about this had me scratching my head, so I was wondering if someone who understands the internal workings of the game better than myself could explain it to me.

Tupac Amaru
05-05-2006, 02:29 PM
The description is nwscript is misleading. The decimals are truncated. For example, 2.9 will be converted to 2, not 3.

Pavlos
05-05-2006, 02:32 PM
Thanks, Tupac.

YAY! Now I understand the game a little better. Lightning fast reply too :).