Printing variable values at runtime

Printing variable values at runtime

truckexpert
Advocate Advocate
667 Views
3 Replies
Message 1 of 4

Printing variable values at runtime

truckexpert
Advocate
Advocate

How does one print several values on a single line. I want to print variable values as a table at runtime. All are floating point single precision. I want to format the output with two decimal places. This is for debugging.

 

Suppose a = 88.1234, b=99.1234.

 

At runtime, I want the listener to echo:

 

88.12  99.12

 

Thanks,

Dave

Peace,
Dave

System Information:
------------------------------
3DS Max 2023 and 2024
Microsoft Windows 11 Pro
Dell Precision 5820
Intel(R) Core(TM) i9-10920X CPU @ 3.50GHz, 3504 Mhz, 12 Core(s), 24 Logical Processor(s)
Display Adapter: NVIDIA RTX A4000
Adapter RAM (1,048,576) bytes
Installed Physical Memory (RAM) 64.0 GB
Total Physical Memory 63.7 GB
Available Physical Memory 45.6 GB
Total Virtual Memory 81.7 GB
Available Virtual Memory 56.5 GB
Page File Space 18.0 GB
0 Likes
Accepted solutions (1)
668 Views
3 Replies
Replies (3)
Message 2 of 4

truckexpert
Advocate
Advocate

Also, it would be nice if there was a format string that handled column alignment, like in FORTRAN (yes, I'm old, thank you).

Peace,
Dave

System Information:
------------------------------
3DS Max 2023 and 2024
Microsoft Windows 11 Pro
Dell Precision 5820
Intel(R) Core(TM) i9-10920X CPU @ 3.50GHz, 3504 Mhz, 12 Core(s), 24 Logical Processor(s)
Display Adapter: NVIDIA RTX A4000
Adapter RAM (1,048,576) bytes
Installed Physical Memory (RAM) 64.0 GB
Total Physical Memory 63.7 GB
Available Physical Memory 45.6 GB
Total Virtual Memory 81.7 GB
Available Virtual Memory 56.5 GB
Page File Space 18.0 GB
0 Likes
Message 3 of 4

denisT.MaxDoctor
Advisor
Advisor
Accepted solution

use format (instead of print) and formattedprint (to format values):

 

format "% % % %\n" \
	(formattedprint pi format:".4f") \
	(formattedprint pi format:".3f") \
	(formattedprint pi format:".2f") \
	(formattedprint pi format:".1f")

 

see MXS help for more details.

0 Likes
Message 4 of 4

truckexpert
Advocate
Advocate

Awesome, thanks!

Peace,
Dave

System Information:
------------------------------
3DS Max 2023 and 2024
Microsoft Windows 11 Pro
Dell Precision 5820
Intel(R) Core(TM) i9-10920X CPU @ 3.50GHz, 3504 Mhz, 12 Core(s), 24 Logical Processor(s)
Display Adapter: NVIDIA RTX A4000
Adapter RAM (1,048,576) bytes
Installed Physical Memory (RAM) 64.0 GB
Total Physical Memory 63.7 GB
Available Physical Memory 45.6 GB
Total Virtual Memory 81.7 GB
Available Virtual Memory 56.5 GB
Page File Space 18.0 GB
0 Likes