|
|
|
Tell us what you think of the site.
|
Autodesk Media & Entertainment User Community
|
Autodesk® 3ds Max®
|
|
Autodesk® Maya®
|
|
Autodesk® Softimage®
|
|
Autodesk® MotionBuilder®
|
|
Autodesk® Mudbox™
|
|
Autodesk® ImageModeler™
|
|
Autodesk® Sketchbook® Pro
|
|
Autodesk® Smoke on Mac®
|
| syntax problem? rollouts?
|
|
|
i imagine this is real basic, but why does this script not work?
rollout ttsmt "smt" width:162 height:300
(
foo = "abc"
print foo
)
if ttsmtfloater != undefined do
(
closerolloutfloater ttsmtfloater
) CreateDialog ttsmt width:162 height:300
i get the error
-- Error occurred in anonymous codeblock; filename: \\stuff\art\Common\jjacobson\scripts\; position: 49
-- Syntax error: at (, expected <rollout clause>
-- In line: (
if i take out all the rollout code i can set and print the variable fine
foo = "abc" print foo
like i said i know this is a simple problem, ive just never learned it or had it explained to me. and to complicate things it seems that sometimes i can define variables in rollouts with no problems.
i’m guessing this all boils down to a simple problem, just cant find it in, or figure it out from the maxscript help.
thanks
|
|
|
|
You can’t execute code directly within a rollout. You need to define functions or event handlers, then put the code in it. You’ll also have to explicitly state that the new variables are either local or global.
rollout ttsmt "smt" width:162 height:300 (
local foo = "abc"
on ttsmt open do
(
print foo
)
)
Also, the bit to close the floater won’t work: you haven’t defined a rollout floater. The rollout will stay defined whether or not it’s open, anyway. You could try this:
try (destroyDialog ttsmt) catch ()
If you are going to evaluate the entire script every time you create the dialog, you’ll want to put that line before the rollout’s definition. If the rollout is open and then redefined, the destroyDialog will try to operate on the new definition, which hasn’t yet been opened as a dialog. The old one will stay open. (It took me a while to figure out that one.)
David “Stokes” Stokes
Senior Technical Artist, Blue Fang Games
|
|
|
Stokes 24 January 2008 02:05 AM
You can’t execute code directly within a rollout.
THANK YOU! You have no idea how long I’ve been trying to nut out why I’m getting this error.
|
|
|
|
|
|