The FormattedPrint method was added to MAXScript in 3ds Max 9. It was previously available through the free Avguard Extensions.
Returns a string representation of value based on the format specified.
The format specified is applied for each component value for values that are comprised of more than a single value.
For values or component values that are floating point numbers, the default format string is "0.8g", for integers, "%d".
The value specified must be one of: float, double, integer, integer64, intptr, string, bool, ray, point2, point3, point4, quat, angleAxis, eulerAngle, matrix3, box2, color, time, or interval.
The optional format: string is of the form:
Width is a non-negative decimal integer controlling the minimum number of characters printed. If the number of characters in the output value is less than the specified width, blanks are added to the left or the right of the values - depending on whether the - flag (for left alignment) is specified - until the minimum width is reached. If width is prefixed with 0, zeros are added until the minimum width is reached (not useful for left-aligned numbers). The width specification never causes a value to be truncated. If the number of characters in the output value is greater than the specified width, or if width is not given, all characters of the value are printed (subject to the precision specification).
Precision specifies a non-negative decimal integer, preceded by a period (.), which specifies the number of characters to be printed, the number of decimal places, or the number of significant digits. Unlike the width specification, the precision specification can cause either truncation of the output value or rounding of a floating-point value. If precision is specified as 0 and the value to be converted is 0, the result is no characters output.
Type:d, i, u, o, x, X - The precision specifies the minimum number of digits to be printed. If the number of digits in the argument is less than precision, the output value is padded on the left with zeros. The value is not truncated when the number of digits exceeds precision. Default precision is 1.
Type:e, E - The precision specifies the number of digits to be printed after the decimal point. The last printed digit is rounded. Default precision is 6; if precision is 0 or the period (.) appears without a number following it, no decimal point is printed.
Type: f - The precision value specifies the number of digits after the decimal point. If a decimal point appears, at least one digit appears before it. The value is rounded to the appropriate number of digits. Default precision is 6; if precision is 0, or if the period (.) appears without a number following it, no decimal point is printed.
Type: g, G - The precision specifies the maximum number of significant digits printed. Six significant digits are printed, with any trailing zeros truncated.
where Type character is the only required format field; it appears after any optional format fields.
I - value being printed is an IntegerPtr
I32 - value being printed is an Integer
I64 - value being printed is an Integer64
For Integer values, the default format is "I32d"
For Integer64 values, the default format is "I64d"
For IntegerPtr values, the default format is "Id"