users own permanent global functions?

Dec 20, 2009 at 9:35am

users own permanent global functions?

hi, lets say i have the following 3 functions:

//get size of object, width*height
//pass maxobject.rect to argument
function getsizeo(array) {
return x*y;

//get x dimension of object
//pass maxobject.rect to argument
function getxdimo(array) {
return array[2];

//get y dimension of object
//pass maxobject.rect to argument
function getydimo(array) {
return array[3];

which would return various parameters from the max object rect function. say i then quit max, then start again on the next day, but this time from new. is it possible for me to make these previously defined functions available to a completely new js script with out having to implement them again? such as every time i want to use them from now to eternity i can just write yval=getydimo(namedobject.rect) without needing the implementation somewhere in my new max patch? hope this makes sense, maybe universal is the word i want

Dec 20, 2009 at 2:07pm

You can either add a javascript file containing your extra functions in the jsextensions folder or have a look at this code which automatically includes other js files into the current one. The advantage with the latter is that if you’re developing/testing the code you don’t need to keep restarting max for it to find the changes, as is the case with the jsextensions method.



You must be logged in to reply to this topic.