PDA

View Full Version : How to avoid restarting Max for script update


CaptEatbones
02-06-2009, 03:22 PM
Hello everybody,

I'm a new Maxscript user. I'm wondering if there is some way to avoid having to restart Max to let the changes to scripts take effect.

Thanks in advance :)

Cheers

Piflik
02-06-2009, 03:32 PM
You don't have to restart max. You just have to re-evaluate the script. (or am I missing something fundamental?)

Bobo
02-06-2009, 03:39 PM
Hello everybody,

I'm a new Maxscript user. I'm wondering if there is some way to avoid having to restart Max to let the changes to scripts take effect.

Thanks in advance :)

Cheers

There are lots of script types in Max (MacroScripts, scripted utilities, scripted plugins etc.)
All of them are evaluated and run immediately. I have never had to restart Max to get a script running, although in some cases it is a good idea after a long development and before final testing to do so to make sure no stray global variable declarations are causing something to work that is actually broken ;)

But you will have to explain in a bit more detail what type of script you are writing and why you are under the impression you have to restart Max. In fact, not having to restart Max is one of the greatest advantages of MAXScript over C++ plugins!

CaptEatbones
02-06-2009, 04:06 PM
Hi,

thanks for helping.

You're right. I'm working on a button macroscript. Everytime I make some change, even evaluating the code, when I click on the button it still keeps the old code version.
The only solution to this has been restarting Max.
I've tried to look for something on internet but I didn't found anything :)

Hope to have been more clear :)

Thanks again,

Cheers.

thatoneguy
02-06-2009, 07:17 PM
Are you closing/reopening the dialog?

CaptEatbones
02-06-2009, 08:08 PM
Well,

with this macroscript I'm creating a floater and populating it with 2 rollouts.

To test the code I obviously close the dialog and then click again on the button to open it again and test the new changes :)

Thanks,

Cheers.

Piflik
02-06-2009, 08:18 PM
That is really quite strange...AFAIK, all MacroScripts only need to reevaluate to use the new code. Have you tried deleting the 3dsmax.ini? That's always the first thing I do, when something strange happens...

(C:\Documents and Settings\Username\Local Settings\Application Data\Autodesk\3dsmax\"Version#" - 32bit\enu)

CaptEatbones
02-06-2009, 08:26 PM
Thanks,

anyway, at the moment Im not at work so I can't try. Tomorrow al try what you suggested and I'll tell you if it works or not ;)

Cheers.

PiXeL_MoNKeY
02-06-2009, 09:37 PM
My guess is you have variables that aren't being removed, or you aren't properly destorying the dialog to remove it, and its variables, from memory.

-Eric

ILS
02-07-2009, 02:24 AM
All you have to do is re run the script again
go to MAXScript --> Run Script .. choose the script again and the floaters should be updated
if you already have a floater open while doing this close and reopen it again. works for me.

LoneRobot
02-08-2009, 08:02 PM
you could just comment out the macroscript line and evaluate it as a normal rollout script until you are happy with it. I usually keep my macros and the script itself separate and just have a filein method on the mcr itself, pointing to the ms file.

CaptEatbones
02-08-2009, 09:08 PM
Thanks. :)

Actually I'm including the script code into the Macroscript. Maybe it's not the same as using that filein method :curious:

Cheers.

LoneRobot
02-08-2009, 09:24 PM
Hi Capt,

The way i understand it, and from what is written in the help, it's a scope issue. filein will run the exterior file in a global scope, whereas include() is similar but will run in local scope of the block it is called within. The main difference is filein is like picking the script with the run script command, and include is like a run-time insertion of the code into what is currently being evaluated, and as a way of breaking long scripts into more managable/editable chunks.

CaptEatbones
02-09-2009, 07:24 AM
Thanks guys for help and explanation. Using the method fileIn() I get the result I want: executing the script updated with the changes I made.
Now I unserstood a little bit more about Maxscript works. I appreciate :)

Have a nice day,
Cheers.

CGTalk Moderation
02-09-2009, 07:24 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.