PDA

View Full Version : Script needs to be evaluated twice for it to work


Fredstrange
06-02-2009, 07:03 AM
I have created a script together with a programmer to convert materials between standard Max materials and our custom shader we use for real time graphics. It work perfectly except that every time you start Max you have to Evaluate the script twice for it to run properly.

Is this a know issue and is there a workaround for it?

SyncViewS
06-02-2009, 08:41 AM
Hi James,
does the script throw any error after first evaluation?
Without any evidence, here is my very very long shot. There could be variables/structures/any other kind of data, the script needs to be already loaded in memory. First evaluation stores those values, but doesn't work because they're not initialized when actually needed, while second evaluation works because stored values are already there, like global values. I hope this helps.

- Enrico

GMS-575
06-02-2009, 10:00 AM
it sounds like a local, global issue. check your variables, functions and so on.

Fredstrange
06-02-2009, 12:00 PM
Thanks for your help. Our programmer managed to solve it by breaking out the functions that were in the script and putting them in a extra script in the scripts/startup folder so they would initialize when max starts. So when we call upon them from other scripts Max knew what to do...

I learn a little more for every day...

CGTalk Moderation
06-02-2009, 12:00 PM
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.