macroScript problems catergory: "unknown"
I have scripted a rollout interface, which is working within max when you run the script. I want to assign it to a custom menu so I need to convert it into a macroscript and put it in stdscripts. When I now load max I get the following error:-
>> MAXScript Auto-load Script Error -- Unknown system exception <<
After removing many lines of code I finally found the offending line.
macroScript MakeRig category:"Rigs" ( --destroy dialog if already open --if (::camRig != undefined ) do (destroyDialog camRig) if camRig != undefined do destroyDialog camRig --main rollout rollout camRig "Create V-Ray Camera Rig" ( local bm1 = bitmap 100 100 color:red local theName = "Camera01" group "Camera" ( edittext prefix_txt "Name prefix: " fieldWidth:165 text: "Camera01" ) group "Rig" ( --imgtag b1 "imgtag" bitmap:bm1 pos:[20,68] button but_cancel "Cancel" pos:[200,210] on but_cancel pressed do ( destroyDialog camRig ) ) ) createDialog camRig 260 240 )
If I remove the following lines:-
local bm1 = bitmap 100 100 color:red
Then I dont get any errors! Can anyone help?
edit: I have just worked out that if I move this line above the rollout then I dont get the error on loading max. I still dont know why you must do this. The other variables like local theName = "Camera01" work fine.
I have also been using the following line to destroy dialog if already open:-
if camRig != undefined do destroyDialog camRig
Again this works in a normal script but if I use it in a macroScript it does nothing! Looking at someone elses script I have found a line that does work:-
if (::camRig != undefined ) do (destroyDialog camRig)
What is the difference and what do the :: mean?
Thanks for any help!