|
MAX SCRIPT TIPS!
From: Marco Vogel Date: Friday, January 09, 1998 04:55 PM
Right, off with the bugs, here's some tips :)
If you have a set of strings, and want to sort the alphabetically, you can use the sort function for an array. But what if you need it reversed ? You can reverse the array ofcourse, but you can also check the alphabetical order yourself, using the < and > operators. For example : txt1 = "Yahoo" txt2 = "World" txt1 < txt2 -- will result in true
Another thing with strings is that they are treated somewhat like arrays. You can't perform any of the more sophisticated array functions on them, but you can retrieve the Xth character in a string by using: txt1[3] -- Will result in the letter 'h'
And if you are fed up with some of the enabled / disabled states of items... ( spinners labels always appear enabled when created, even when set to enabled:false, and radiobuttons captions won't ever disabled to a grey text :) ) Just use dummy text labels to fake them. For example :
label size_dummy "Size : " enabled:false spinner size "" range:[0,100,10] offset:[30,-18] enabled:false
You need to use the offset parameter to make sure the spinner resides next to the label.
Another great feature in MaxScript is the 'execute' command. With it, you can execute user defined parameters from ( for example ) edittext boxes. Supply a 'help' button showing the variables a user can and may change in the script, and you extend the abilites of your script by lengths. For example, you can create a script which does nothing more than create a 2D grid. Next you supply a user-definable field for the Z axis, and supply the variables you use to define the X and Y axis, and before you know it, you'll have MathMax(tm) in a maxscript version, though not animatable ( unless you want to use morphs ;) ).
And on a final note, remember that when you're creating a quality script, that users can't screw it up. For example ( and I hate naming this one, because in all, it's a GREAT script, a must-have ) in the Galaxy System scripts, you can alter many of the parameters, resulting in an exception immediately, because you haven't yet created the galaxy itself. A simple enabling and disabling of the controls would easily prevent these kind of user-caused errors. Also, try and create your script in an intuitive way. Don't create rollouts that extend 2 screens. Remember for value assigning controls in the form of sliders, that 'up' and 'right' are to most people 'higher', or an equivalent of that word. Again ( Sorry Mr. Takee ), in Galaxy System you can see that to make the nebulae more 'Dense', you have to move the slider to the left.
I hope this has inspired a few people, with new ideas, or maybe gui enhancements.
Regards, MarcoV PS. If you are reading this Tetsuya, please regard my using your script as an example as a form of respect. It is truly a great script. |