PDA

View Full Version : How to call many script files organized?


f97ao
03-18-2006, 08:55 AM
I'm wondering if you guys use a special way to treat many maxScript files that are included in a project.

Untill now I have rarely used more than 2-3 files, and then it's pretty easy to handle manually, but I'm thinking about using say 5+ different ms files in a project.

*Basically the other scripts need to be called from the main script (by just loading the file). However we don't want to load it if it has already been loaded (unless you FORCE a load).

*Another thing that creates problems is if you decided to publish the project and convert all the files to encrypted files. Then the load command of course has to change since the file is named differently.

*Another problem is I keep adding version numbes to all my files so they change again, for example Polyspeed 0.99 ->0.99a. Normally I always have ONE file in the folder, and move the old versions to another OldVersion folder so I guess you could just search by the main name.

*Sometimes you changed something in a sub script (interface for example), so all the others have to be recompiled. Would be nice to have a fast way of doing that (now I just manually open them and recompile them one at a time).

I'm thinking perhaps it's worth the trouble to do a ProjectClass that keep tracks of all the files in a Project and lets you easily encrypt them, initialize them and force an reinitialization of them.

Ideas?
/Andreas

rdg
03-20-2006, 09:37 AM
adding version numbes
You could try a versioning system to keep track of your different files?
Subversion/CVS maybe, as Autodesk fault isn't targeted for ascii-files.

The Project-class could read a external file or something like a make --configure.

Or someone creates a eclipse add-in for maxscript.

Georg

f97ao
03-20-2006, 10:59 AM
You could try a versioning system to keep track of your different files?
Subversion/CVS maybe, as Autodesk fault isn't targeted for ascii-files.

The Project-class could read a external file or something like a make --configure.
Or someone creates a eclipse add-in for maxscript.
Georg

It's not so much the version numbers I have problem with, but with the linking and definitions.
The more I program in maxScript the closer to standard c++ I feel my code is. I'm even considering using header files.

I'm considering to do something like this. All ideas are welcome, feels like I'm reinventing the wheel here.

***********

-The LinkClass is in a separate file.
-In every ms file, it checks. If LinkFile==undefined do Load LinkClass.ms
-If the LinkClass is loaded it first checks for ms files (for example polyspeed* (so the version number doesn't matter). Only at my home the ms files will be loaded in my PolySpeed Code folder. For everyone else the mse files will be loaded, they are all placed in a different folder named PolySpeed.

I could also have some functions for the LinkClass for example Publish()
Publish encrypts all the ms files and moves them to the right folder.
Perhaps it can also update the code for the NSIS Installer (it's tricky to make sure all the files are included in the installer/deinstaller, the publisher could write this stuff automatically).

Any ideas? I'm perhaps the only that thinks it's painful to publish scripts with every new build.

/Andreas

rdg
03-20-2006, 11:12 AM
I'm perhaps the only that thinks it's painful to publish scripts with every new build.

Maybe one of the few who build so complex scripts ...

If you get closer to c++, you really need to research (if you dont' already know) the stuff c++ makes great.
Maybe you can build your own preprocessor-hook that pushes your scripts through a c-preprocessor and replaces the constants.

this could solve some of your problems, as you could switch between release and debug builds.

And then completely switch to c++ ...

Georg

f97ao
03-20-2006, 11:44 AM
Maybe one of the few who build so complex scripts ...
And then completely switch to c++ ...
Georg
Yea, I think I'm pushing MaxScript a little bit. I have so many functions in my program that with 1600x1200 resolution if I right click the functions cover several screens (makes it hard to navigate!).

I don't think I will switch completely to c++ in quite while. You can develop scripts so fast, c++ takes a lot longer. But my next major project is planned to be 100% c++. Phew, need to do some serious reading up. :)

/Andreas

rdg
03-20-2006, 11:53 AM
I have so many functions in my program that with 1600x1200 resolution if I right click the functions cover several screens (makes it hard to navigate!)

Sounds like you need a interface designer - I should take a look at it.

Do some research on eclipse - an opensource development platform for java (?), utilised by a lot of different scripting communities.
ie. the flash comunity was/is on a similiar point like you: the switch from a interpreted script-language to a full featured programming language.

as there are maxscript extensions to let you edit the scripts in ultraedit and execute them back in MAX, like the flashout-command, you should be able to use the features of eclipse for your projects.
which is like close-to-c++-but-not-c-yet.

Georg

f97ao
03-20-2006, 01:33 PM
Sounds like you need a interface designer - I should take a look at it.

Do some research on eclipse - an opensource development platform for java (?), utilised by a lot of different scripting communities.
ie. the flash comunity was/is on a similiar point like you: the switch from a interpreted script-language to a full featured programming language.

as there are maxscript extensions to let you edit the scripts in ultraedit and execute them back in MAX, like the flashout-command, you should be able to use the features of eclipse for your projects.
which is like close-to-c++-but-not-c-yet.

Georg

I haven't taken the plunge into Ultraedit yet, but I plan to soon. It's a very nice program. Do you use it yourself for MaxScripting?

I will check out Eclipse too, thanks for the tip

My error handling class is almost finished by the way, it turned out quite well. I even did a nice picture for the Error Report window, I just barely refrained from writing "Don't panic" with calm letters on the image.

/Andreas

f97ao
03-22-2006, 08:09 AM
I've been thinking about this for a few days now.

I think the best way to do this is actually to work with the files in a similar way as to C++.
So to have a
file.h
and file.ms (or mse)

And these files are included in the different projects.

The h files don't have to be elaborate at all, they only need to list the function or the class.
so
fn CreateObjects=()
Empty Temp classes should also be created.

In fact this is probably the only way to handle if you have many different classes and functions in different files. Because as you probably now they must be declared BEFORE they are used, or they will be undefined. So if we have many classes calling each other, and they are from different files, well, then it won't work.

Then it would probably be a good idea to do a project class, that keeps track of all the files in a project. The project can encrypt all files, reinitialize them and run the project.

The trickiest part is how the include and project parts should be handled in the beginning of each file. Perhaps if the project is in it's own file so project.ms You run this the first time and then it's a global variable. When you need to run the code you just write

project.run()

One Idea I just got, is that perhaps the project checks if any changes have been made to the files, and if it has then it will run it again. If it's linked to others then these others will also run.

The most convinient would be that if you are working on a file for example interface.ms then you can just press Ctrl+e like normal, and the project class will take care of all the linking and "recompiling" if it's needed.

Tricky stuff this. Anyone has any ideas?
/Andreas

scorpion007
03-23-2006, 11:05 AM
There's a freeware maxscript bridge application that can be used to execute your maxscripts from a command line. It also allows encyption.

I'm thinking a makefile could be useful for this.
What i do at the moment is have a maxscript that gets you to pick a directory, and it will encrypt all .ms files under it recursively.
My project is source controlled under SVN.

You might want to consider using version control software.

CGTalk Moderation
03-23-2006, 11:05 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.