To install a single script in 3ds max is very easy if you know what you’re doing. But when you give your scipts to a colleague or client who might not be that confident with scripts, you could use some kind of delivery system or installer. There are several options, like the NSIS installer-program (Article by Jeff Hanna) or the max-native mzp-files.
Plenty arguments exist in favor and against both systems. I chose to use the mzp-file because it’s easily integrated in 3ds max, doesn’t employ different programs which need to run separately, and looks familiar to a max-user. I assume the stuff I do in this script can be done with a separate installer also.
The procedure for the scriptuser is as follows:
- Drag the .mzp-file into a viewport
- Pick one of the main options in the dialog: Install or Uninstall
- Maybe read the message, which contains some information
- Press the “proceed” button to get on with the procedure
This will copy the script file and any supporting files, such as xml-files or images to a specific folder (the “Userscripts” folder). It will also create a macroscript automatically to be able to put the script in your interface. This means my installer only handles normal scripts at the moment. An .ini file is also created which contains information about the script.
The installer window shows you the scriptname and a description. Both pieces of information reside in the .ini-file which has to be created. The user has two main options: to Install or Uninstall, that’s the question.
As an example, we’re installing a new script. The installer checks if the script already is installed, and if it’s newer or not. This check is performed using the “version” key in the .ini-file.
For the scriptwriter:
- Write an .ini file which contains the minimum amount of information
- Bundle the .ini together with the mzp.run-file, scriptInstaller.ms, your script and any supporting files into an .mzp
- Distribute the .mzp
The ini is critical here. It contains the information the installer needs to perform. Filename, category, supporting filenames, description and a versionnumber are neccesary. Other info may be added, but doesn’t help with the installation. A future release would encompass a packaging script to make it easier for the scriptwriter creating these packages. Automatic .ini-file creation would be part of that.
So before making the .mzp-file with your favourite zip-program you need the following:
- theScriptInstaller.ms: the installer script. You don’t need to edit this one
- theScriptInstaller.ini: the .ini-file containing the filename, version, etc. An example is added here
- mzp.run: this one is needed in every .mzp-package. It just tells max where to unpack everything and to run the installer
- scriptfiles: the actual script you want to install. The filename should be the same as the filename-key in the .ini-file.
- supporting files, if any: filenames of these files should be entered in the proper array in the .ini-file