PDA

View Full Version : 3DS maxscript - Variable assigned to object


YannickLeclerc
03-03-2011, 05:45 PM
Hi all, quick question, I am assigning a variable to an object, so when I press a button it creates the object, I also have other buttons to hide this object and freeze it, the problem is when i exit the scene and load it again, the variable is not assigned to that object anymore so the freeze and hide button are not working anymore.

ex:

--create button
c= box ()

--hide button
c.ishidden = true

something like that its not exactly it but you get the idea... So my question is how do I tell max to store that variable in the scene...is there such a thing?

Thank you all

The Prime
03-03-2011, 06:10 PM
You could possibly create a script that runs when Max opens, to rename that variable. I think you would have to place the script in your startup folder, and it should run the script when you open Max... I think. Scripting isn't my strong point.

YannickLeclerc
03-03-2011, 07:07 PM
yeah I thought about that but my script opens up a window so it would be kind of annoying, moreover I dont think it would work because once you quit the scene, the objects loose its variable so its not associated with it anymore so even when running the script it wouldnt find it.

But someone answered on cgtalk with exactly the answer I was looking for

persistend global variable

http://www.kxcad.net/autodesk/Autodesk_MAXScript_Reference_9/Persistent_Global_Variables.htm

thanks