View Full Version : Irritating MaxScript Problem
23-06-2006, 10:28 PM
This is probably really simple, but for some reason I can't get it resolved! I've looked everywhere, but there really aren't very many tutorials for Maxscript that don't cost $60 for a DVD. Worse yet, this problem happens in the tutorial files included with Max, too! :wall:
I'm including a screenshot to show you all what's going on; I'm getting a
-- Syntax error: at ), expected <factor>
-- In line: )
After the last parenthasis in all my scripts; and it's ruining everything I try to make. What's going on? What on earth is a factor? Why is this problem existing in the TUTORIAL FILE? :grr:
24-06-2006, 01:46 AM
The problem is that the "mentalPal_CanvasRollout" rollout object was never actually created. I'm pretty sure you need to createDialog mentalPal_CanvasRollout before you can destroy the dialog. In order to do that, you need to wrap this entire thing in a macro.
now the dialog will be created by the macro before it tries to destroy it.
Also, btw, when you evaluate a macro, it won't execute. It will be added to your plugins. So, you need to customize your UI and make a menu for it so you can test it.
Edit: you may also have to give the macro a category. To do that, make the first line something like this:
macroScript mentalPal category:"Mental Ray"
26-06-2006, 01:37 AM
Correct-a-mundo Buzzy. That turned out to be the case. I've also run into an interesting dilema; is there a way to max-script a change in the mental ray sampling quality? By default it's [1/4] :  but I wanted this script to make that variable; any thoughts?
I tried <mental_ray_renderer>.MaximumSamples but that's not the controller for...well...maximum samples...
29-06-2006, 03:24 AM
In case you haven't figured this one out yet, I looked into it for you.
Basically, you first have to assign mental ray as the current renderer. You do this with:
renderers.current = mental_ray_renderer()
Now, all those variables available in <mental_ray_renderer> are in renderers.current
So, this becomes possible now:
renderers.current.minimumsamples = x
renderers.current.filter = x
The min and max samples for mental ray are actually done with powers of 4. For example, a min value of -1 will give you a samplerate of 1/4. A value of 0 will give a sample rate of 1. and a min value of 3 will give you a sample rate of 64.
Hope this helps you.
29-06-2006, 03:37 AM
Sweet! Yah, I did find it in another script, which was pretty handy; but I bet this thread will be helpful for someone who's looking for this kind of information in the future.
:xx: I'm kind of ashamed, since this should be in the Coding/Scripting forum; but that place is a dead-zone. I'd never get a response there!
Thanks again Buzzy!
vBulletin® v3.7.4, Copyright ©2000-2013, Jelsoft Enterprises Ltd.