[Closed] MaxScript Newb Problem: expected <factor>
This is probably really simple, but for some reason I can’t get it resolved! I’ve looked everywhere, but there 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! This is my last resort before I totally freak out!
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. I can’t figure out what’s wrong with my syntax. What’s going on? What on earth is a factor? Why is this problem existing in the TUTORIAL FILE too?
Any thoughts?
First of all, next time please post the code, not a screenshot. Do you think people have time to type letter by letter your code to figure out a SYNTAX error?
Anyway, the first obvious error is in the first line – you are assigning a class to the current renderer, not an instance of the mental ray renderer. In Max 8, this causes the error
– Unable to convert: mental_ray_renderer to type: Renderer
But I could not find a SYNTAX error in the code you typed, and after adding the line
createDialog mentalPal_CanvasRollout
it actually created the dialog you defined. Pressing the button closed the dialog as expected.
So you must have mistyped something somewhere, and without the REAL code posted here, I cannot tell what it is.
If you used the F2 (Visual MAXScript Editor – I bet you did), there might be something wrong with the file formatting that is not visible to the eye. Try saving the file, closing and opening it. If it still throws that error, post the actual file instead of pasting it in the post.
I think this could help:
on btnl pressed do
(
destroyDialog mentalPal_CanvasRollout
)
or you put the action directly in the line with the pressed thing
on btnl pressed do destroyDialog mentalPal_CanvasRollout
Holy Toledo! It’s Bobo! I know you; I’ve seen you’re work around! :bounce: You’re like a celebrity!
I’ll have a look at it again and get back to you; thanks again for your help!!
P.P.S. I’m catching on; sooner or later… =)
I broke down the code a little more, hopefully removing stuff that is not crucial to solving this problem. I’ve managed to start getting
CreateDialog()
from the listener, but nothing’s popping up yet. =
I’m including the broken down script here as bd_SandBox.txt
Remove “rollout” from the CreateDialog() call.
createDialog mentalPal_CanvasRollout
It requires just one parameter, which IS a rollout definition. (See my previous post, too).
The Help file says
CreateDialog <Rollout> …
<Rollout> is not written in bold (as is), but in <> which is a RULE that means “replace with something that is a rollout”…
Hurray! It works! I’ll keep fiddling with this; and thanks again for your help Bobo! I’ll probably be on here alot, since I’m trying to pick up MaxScript to augment my workflow.
And, of course, the finished script. I’ll probably use this as my template for tom-foolery for some time; since now that it’s working I can springboard other features from it. =D