Notifications
Clear all

[Closed] Why does my MaxScript work sometimes and then not

Attached script and sample scene to play with.

You should be able to launch scripts by using Tools>Evaluate All and watch it rig the bones.

I had a problem which I thought I had cured when the scripts crash Max. Now it’s back and I’ve no idea what to do. Just wanted to see if someone else could recreate the error.

If I select chunks of script and do Tools>Evaluate Line/Selection it works. Very strange.

4 Replies

fwiw – crash confirmed. Lots of UI flickering followed by some error (didn’t see it… will have to enable logging or keep listener in view) followed by a long pause while max decides to crash and eventually the crash itself.

looks like the errors generated are all of type…


Type error: custAttributes.add requires MSCustAttribDef, got: undefined

caused in…


rig_foot()
rig_foot()
addkneehelper()
addkneehelper()
createHandCtrl()
createHandCtrl()
RigShoulder()

I’d imagine another RigShoulder() should have followed, but max crashes before that

looks like there’s several confusing bits and pieces…

the custattributes are set up in an execute(), but they don’t actually enter the max system for further evaluation in your inline script until the function is closed… so you’d probably have to generate those outside of the function; though I don’t see any dynamic part of the attribute definition, so I’m not sure why you’re using execute in the first place…

then once the attribute has been defined, it gets stuck in rig_foot() on…


$.transform.controller.goalSize = 6 /* change size of controller */

stating…


-- Unknown property: "transform" in $selection

which sounds about right, as the current selection is multiple objects – all the bones, looks like. That’s due to rename_objects(), which selects all of the objects.
( for kicks – if it didn’t… what object was -supposed- to be selected for rig_foot() to work properly? )

Is there a chunk of code missing somewhere, somehow?

Many thanks for your time spent on this.

I’m going through the script again.

Do you know a better way to do the Attritube Holder? I have tried the method used for the PEN_Attibute_Holder 2 but using ‘Attribute_Holder’ is not recognised. Does it have a different name in MaxScript?

I’ve just changed the order in which the Attritube Holder is defined. The whole scripts runs through with no errors. It’s done that before and then broken again.

Anyway, if you get time, try the attached script.