Dealing with floating point values in MAXScript is almost inevitable, as are the accuracy problems connected to that.
The built-in progress bar in max status bar is not suited for every task, and as I have found myself writing quite similar lines of code to print debug info to the prompt and trying to prevent max window from 'not responding' over and over again, I whipped up a little struct to make it easier.
Sometimes it is desirable for rollout controls to keep their values when you close the dialog and open it again. There are many ways to achieve that, one of the easiest is using locals declared in a macroscript body and using its
on execute handler to initialize the rollout. When a regular script is used instead, a global struct or a global set of values can be used, but there is also another method which might be more suitable in many cases.
As I've indicated in my previous retrospective that there's a skeleton in my closet, a bulk of code waiting to be commented. Let's now have a look at a piece of code from almost a year ago (original question at Stack Overflow: Give each object in scene a unique wirecolor?).
Shuffling an array is a fairly common task in the world of maxscript, and even if you don't do it quite right it's still okay for most of the tasks it's used for. However when unique array elements get dropped in the process and other are repeated, it's definitely not the expected outcome.
I have recently published an info-strip script that allows custom information to be displayed in the rendered image, just like the v-ray frame stamp, but this one supports all renderers using the VFB (most notably mental ray and scanline). Together with user defined font size, style, colors and opacity of the strip background the user can define expressions to include things like photon count, diffuse bounces number etc. in the displayed information. There are five custom fields for simple expression and one field for custom script if you need some more elaborate way to get the desired result. In this tutorial I will show how these fields can be used to their full potential.