View Full Version : Managing scripts and paths in larger projects
05-01-2008, 12:49 PM
I've never really found a good way to manage scripts as they get bigger in 3dsmax.
The most annoying thing is that max keeps changing it's current script directory, so just having a filein "file.ms" is dangerous, as the live directory will change the next time another script is accessed.
As well, I'm creating some scripts for clients at the moment that need a file here, and a file there, and it would be nice to be able to package them up and send them as something they can just run.
I've been reading about mzp and mse files, and they seem like they might do (parts of) the job, but if my memory serves me well, last time I played with them, I had very mixed results so I didn't continue.
Does anyone have any good workflows / tips etc to make breaking down bigger scripts, or packaging multiple smaller scripts, easy and most importantly to have them actually work?
Should I be using absolute paths? Should I start using a versioning system like Subversion?
05-02-2008, 03:16 PM
We use one big MZP for our stuff and haven't really hit any problems with that. You do have to make use of known paths, but you can use path literals and the getDir() function to always get the folder-du-jour for a given 3ds Max installation.
E.g. if you extract all your files to '$scripts\Dave\' in the MZP run file, then '(getDir #scripts) + "\\Dave"' should yield the same folder - users changing paths around between installation and their running your script aside.
I've run into a lot of problems with using the .run file to actually take care of extracting things where I want them, running scripts, etc. - mostly to do with not having any control over which commands get run in which 3ds Max versions and such, so I've taken to using the mzp.run file to only...
1. Extract the files (to a fixed location in $scripts)
2. Run a single maxscript file that then takes over the task of actually distributing the files from there (icons to the appropriate location, etc.), and running them according to the max version in use.
The only problem I've run into was an assumption problem on my own end - that nothing would clear the max $temp (either system temp as pre-R9 or max-temp in R9+) while in a max session. Something actually did on one client's machine, so now everything goes in $scripts , and another script takes care of cleaning out temp files from there on shutdown.
P.S. forgot to note... MSE is the same as an MS, except that it's encrypted. I wouldn't rely on it for anything but preventing cursory glances (it's easily hacked from within maxscript itself) and makes any archive (ZIP or MZP - which is just a ZIP anyway) of the file larger as it can't compress it down as nicely.
05-03-2008, 04:17 PM
Thanks for the info! I'll check out some of the things you recommend.
Anyone else, feel free to chip in too.
10-21-2008, 09:58 PM
maybe too late. But this might just be what you were looking for.
I've written a script to install scripts using an .mzp-file. It gives the user an interface and some information about the script they're installing. It gives the scriptwriter a way to distribute scripts (and supporting files) with more confidence.
The script is copied to a folder in the #userscripts directory. An .ini-file is also created. the user has to customize the ui to incorporate the installed script in the interface. That's about it.
This is what you get after dropping the .mzp on your viewport.
It kind of grew into an installer while i was working on it. I also was looking for a secure way to distribute small scripts across my office.
Example 1 (http://www.klaasnienhuis.nl/WordPress/wp-content/uploads/2008/10/the-package.mzp)
Example 2 (http://www.klaasnienhuis.nl/WordPress/wp-content/uploads/2008/10/buttonpicturegamma-package.mzp)
Article on website (http://www.klaasnienhuis.nl/WordPress/2008/10/installing-single-scripts-in-3ds-max/)
10-21-2008, 09:58 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.
vBulletin v3.0.5, Copyright ©2000-2015, Jelsoft Enterprises Ltd.