Inept Scripting

Hey guys,

I’m creating a custom rig for a rhino, for Unreal 3 and I seem to be the most inept person to have ever worked with MaxScript.

I just want to get some custom controls scripted for parts of my rig (sliders/spinners) and I’m probably doing something daft which is glaringly obvious to someone who knows what they’re doing, but I can’t see what it is.

ca=attributes RB_Rib_Control
(
parameters params rollout:RB_Rib_Control
(
footRoll type:#float ui:RB_Rib_Control

)
rollout RB_Rib_Control "RB_Rib_Control"
(
	local range=[-90,90,0]
	spinner RB_Rib_Control "RB_Rib_Control" range:range
	
)
rollout SecondRollout "Reset Button"
(

button Resets “Reset”

on Resets pressed do
    (
    RB_Rib_Control = 0
	
    )
)

)
custAttributes.add $.modifiers[1] ca

I thought it was simply a matter of making sure that I had the Attribute Holder on the part I was scripting for, but that hasn’t solved it either.

Can anyone haul me out of this pit of fail?

Pat

what is

$.modifiers[1] ca

?

Where does it come from?

I thought that was to refer to the Attribute Holder modifier, on my control. ‘[1]’ = it being the first modifier on the stack and ‘$’ as the one selected. Or is that not needed?

Hey Pat, the modifiers call is fine, though it’s often safer to call the attribute holder by name rather than by where it sits in the modifier stack. The problem with the script you have is that you’re defining multiple things as RB_Rib_Control and 3ds Max doesn’t like having so many things with the same name. Specifically you have the rollout and the spinner in the rollout defined to the same variable. The code below works for me by changing those names a little. Hopefully it works for you.

ca=attributes RBRibCon
(
	parameters params rollout:RB_Rib_Control_rollout
	(
		footRoll type:#float ui:RB_Rib_Control

	)
	rollout RB_Rib_Control_rollout "RB_Rib_Control"
	(
		local range=[-90,90,0]
		spinner RB_Rib_Control "RB_Rib_Control" range:range

	)
	rollout SecondRollout "Reset Button"
	(
		button Resets "Reset"

		on Resets pressed do
		(
			RB_Rib_Control = 0
		)
	)
)
custAttributes.add $.modifiers[#Attribute_Holder] ca

Thanks, Micah. Really appreciate the feedback :):

Unfortunately I tried the code and I got this error:

Fresh max2009 scene, ran the script onto a torus with an attribute holder applied to it.
It’s legit code.
My best guess is your scene is f*cked or theres a problem with the ca variable. Have you used it as a (persistent global) variable in that scene previous to this problem?


Welcome to MAXScript.

<AttributeDef:RBRibCon>
true

Thanks for the suggestions guys, but it turned out to be as trivial as I had expected.

Because I use a laptop and I don’t have a numpad with a return key, I was using the normal ‘enter’ key which was causing Max Listener to read a single line of script, rather than the lot.

As you guys mentioned, the code worked fine so now I’m the happy owner of a custom slider. I just need to make sure I’m using ctrl + e to evaluate it, in the editor.

Thanks for the help guys.

I’ve set a joystick control for my rib bone as a test. With this, animation for a belly wobble can be created in three dimensions, to match a walk cycle.

I’m creating an IK/FK blend set up for my leg, but when I come to apply an orientation constraint from the ‘blend foot’ to the IK, it flips and I can’t adjust it back into place.

Any suggestions?

[QUOTE=Patackular;8390]I’m creating an IK/FK blend set up for my leg, but when I come to apply an orientation constraint from the ‘blend foot’ to the IK, it flips and I can’t adjust it back into place.

Any suggestions?[/QUOTE]

do you have the “Keep initial offset” checkbox (I think that’s what it’s called, I’m batching right now and can’t check) active in the orientation constraint? Or is this issue occurring somewhere further down the line?

Aha! Thanks, Tim. Checked that an it seems to have done the trick. :nod:

Ok, although it did snap the bone back into the right place, when I come to move it using the blend, it flips off at an angle, not following either the IK or FK set up.

Another issue I’m having is that creating a knee rotation control for my IK leg, causes my leg bones to flip when it’s activated to ‘Use’, in the properties.

Turns out that the flipping in the foot was being caused by an incorrect orientation constraint to the control and not the foot. Still no idea on the knee control front.