I have a couple Max Script questions that are pretty basic.
1. How to I call an .ms script with an .mcr?
For example, here is one of the textools mcr's.
macroScript relax_selection category:"TexTools" ButtonText:"Relax" toolTip:"Relax"
(
if (rl_textureTools != undefined and rl_textureTools.open == true) then(
fn_16__relax();
)
)
How would I call that same script *fn_16_relax" without the if statement requiring textools to be open?
2. Is it possible to copy the contents of an .ms file into an .mcr to create a basic hotkey so that the function could be performed without having the .ms file? If so, what framework is required? If not, why not?
3. Is there a good resource for learning the basics of maxscript? I've found some video tutorials on scriptspot, but they don't really get into this type of stuff.
Replies
1. Type: macros.run "categoryName" "macroscriptName"
in your case is: macros.run "TexTools" "relax_selection"
2. The macroscript you shown already creates an Action accessible in Customize panel to associate it to shorcuts, toolbar buttons and quads. What do you want to do?
3. The best resource to start picking up MaxScript is its reference. It is quite daunting at first but has some introductory sections, like MaxScript for casual users.
You may want to take a look at DVDs published by CG Academy.
I get the following error when trying to run the script "-- Type error: Call needs function or class, got: undefined". I assume that it is either because i have a syntax error where the function hasn't been declared or something, or there is some deeper problem where it doesn't work because textools isn't running and thus doesn't recognize the function.
2. I want to copy the contents of fn_16_relax.ms into the .mcr so that instead of the .mcr calling the .ms file, it just runs the script within the mcr. Is that possible?
This has to be loaded into memory on max load, or whenever really, but I just have a separate .ms file to load in all my .ms and .mcr files on max load.
For your second question, yes you can do that.