[Closed] macroscript mystery behavior
I’ve written a MacroScript and I’m getting some strange behavior on installing it.
-
When the MacroScript is run (to install it) the first time, I assumed it’d wind up in C:\Program Files\AutoDesk\3ds Max #\ui\macroscripts. Instead it goes to C:\Documents and Settings\Administrator\Local Settings\Application Data\Autodesk\3dsmax\9 – 32bit\enu\UI\usermacros. Is this the norm?
-
The macro is named Macro_Blahblah, but when it’s loaded the name is changed to Object_Blahblah.
-
When the macro is first installed it runs just fine. When Max is closed and reopened, an error window pops up indicating that a couple of lines of code are missing. If the external macro file is run again, that fixes the problem for all successive closings-reopenings. It’s always the same missing lines, which makes me wonder if that isn’t what’s the problem. It’s an action for custom attribute button and reads as follows:
on btn_engage pressed do
(
this.targetedObject.rotation.z_rotation += 1
this.targetedObject.rotation.z_rotation -= 1
)
When code gets deleted it reads as follows:
on btn_engage pressed do
(
this.targetedObject.rotation.z_rotation +
In other words, when the button’s pressed, a targetted object rotates one degree then rotates one degree back. Is this an illegal operation? Many thanks in advance.
-
This has been the default behavior when running with user profiles since Max 9. If you switch from user profiles (for example if you are not using Vista), the default \usermacros folder will be under 3dsmaxXXXX\ui, but user macros will not be written to \macroscripts anymore. This was dictated by Microsoft’s decision to disallow writing to the \Program Files folders in Vista.
-
This has always been the case – a macro script is automatically names using the Category name first, then the name of the macro. You can call your file whatever you want, the auto-generated .MCR file will always be Category-Macroname.MCR. Except in the cases where you manually copied your source file to the \usermacros folder, thus avoiding the auto-generation.
-
This sounds like a bug/glitch (I have heard of it happening, but have never seen it myself). For some reason, the source code gets truncated. Try copying your source file manually to the \usermacros folder and see if it will work. Then keep on editing the \usermacros copy.
This would be the same issue then that davestewart is having:
http://forums.cgsociety.org/showthread.php?f=98&t=632613
Haven’t come across it myself though…
-Johan
Thanks for the prompt responses, guys. Bobo, I appreciate the comprehensive explanations (Cripes, I would have appreciated any explanation :hmm: ). Many thanks for including that link, Johan; I see that using the .mzp file type is a workaround.
:bowdown:to you both.