Formatting Numeric Values in Script
by Paul Drust · in Torque Game Builder · 06/04/2008 (6:43 pm) · 0 replies
Howdy,
I'm a TGB noob.
Can someone enlighten as to how to format numeric values in script.
For example:
A) rounding 12.3456 to 12.35 (with variable decimal precision),
B) truncating 12.3456 to 12.3 (with variable decimal precision),
etc.
I had assumed there would be a TorqueScript version of printf(), and there is, but it appears to only be available when formatting data for display on the console.
Am I just wrong? Missing the obvious? Fruitlessly optimistic?
Help Mr. Wizard!
I'm a TGB noob.
Can someone enlighten as to how to format numeric values in script.
For example:
A) rounding 12.3456 to 12.35 (with variable decimal precision),
B) truncating 12.3456 to 12.3 (with variable decimal precision),
etc.
I had assumed there would be a TorqueScript version of printf(), and there is, but it appears to only be available when formatting data for display on the console.
Am I just wrong? Missing the obvious? Fruitlessly optimistic?
Help Mr. Wizard!
About the author