SimplyMaya Forums

Welcome to the forum, feel free to ask questions here.


SM Forums / Maya Questions / Programming / Simple Expression please help!

Programming MEL Scripts, Expressions & Programming Related Topics

Join the conversation. Reply to post
 
Thread Tools
07-02-2017, 08:36 AM   #1
takecake
Registered User
 
Join Date: Jun 2012
Posts: 1
Simple Expression please help!
Greetings,

I'm trying to write a simple mel expression for my character rig, but each time i hit Create in the expression editor it says i have a syntax error in the last line (line 19.1).

Would anyone please be able to look at my simple expression and help me find what's wrong with it?

Thanks!


//check if there is rotation in Z
if(R_FK_Shoulder_CTRL.rotateZ != 0) {
// if there is rotation in Z, check if there is rotation in X
if(R_FK_Shoulder_CTRL.rotateX !=0) {
//if there is rotation in X after Z, then ik handle roll = rotateX / -2
AO_R_BendArm_ikHandle01.Roll = R_FK_Shoulder_CTRL.rotateX /-2}
// if there is no Rotation in X after Z, then Roll = 0
else {AO_R_BendArm_ikHandle01.Roll = 0}
} // if there was no rotation in Z in the first place, check if there is rotation in Y
else { if(R_FK_Shoulder_CTRL.rotateY != 0) {
// if there is Rotation in Y, check if there is Rotation in Z after Y
if(R_FK_Shoulder_CTRL.rotateZ != 0) ;
// if there is Rotation in Z after Y, Roll = rotateZ / -2
AO_R_BendArm_ikHandle01.Roll = R_FK_Shoulder_CTRL.rotateZ /-2;
// if there is no Rotation in Z after Y, Roll = 0
else {AO_R_BendArm_ikHandle01.Roll = 0} };
// if there was no Rotation in Y in the first place, Roll = 0
else {AO_R_BendArm_ikHandle01.Roll = 0};
}

Last edited by takecake; 08-02-2017 at 06:36 AM.
  Reply with quote
11-02-2017, 03:20 PM   #2
NextDesign
Technical Director
 
NextDesign's Avatar
 
Join Date: Feb 2004
Posts: 2,988
Space it out, and it becomes more apparent. There are multiple issues with the nesting of your conditions, as well as semicolons.

Code:
//check if there is rotation in Z
if(R_FK_Shoulder_CTRL.rotateZ != 0)
{
	// if there is rotation in Z, check if there is rotation in X
	if(R_FK_Shoulder_CTRL.rotateX !=0)
	{
		//if there is rotation in X after Z, then ik handle roll = rotateX / -2
		AO_R_BendArm_ikHandle01.Roll = R_FK_Shoulder_CTRL.rotateX /-2
	}
	// if there is no Rotation in X after Z, then Roll = 0
	else
	{
		AO_R_BendArm_ikHandle01.Roll = 0
	}
}
// if there was no rotation in Z in the first place, check if there is rotation in Y
else
{
	if(R_FK_Shoulder_CTRL.rotateY != 0)
	{
		// if there is Rotation in Y, check if there is Rotation in Z after Y
		if(R_FK_Shoulder_CTRL.rotateZ != 0) ;

		// if there is Rotation in Z after Y, Roll = rotateZ / -2
		AO_R_BendArm_ikHandle01.Roll = R_FK_Shoulder_CTRL.rotateZ /-2;

		// if there is no Rotation in Z after Y, Roll = 0
		else
		{
			AO_R_BendArm_ikHandle01.Roll = 0
		}
	};
	// if there was no Rotation in Y in the first place, Roll = 0
	else
	{
		AO_R_BendArm_ikHandle01.Roll = 0
	};
}
__________________
Imagination is more important than knowledge.
  Reply with quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Expression on Bend Deformer Problem Calvin Programming 0 22-08-2016 08:24 AM
simple expression question lxhtin Dynamics & Special Effects 0 04-11-2012 08:52 PM
:help: Problem with varying refractive index using Expression Editor EonStrife Lighting & Rendering 4 15-12-2011 04:12 AM
rotation expression troubles bendingiscool Programming 1 26-10-2007 10:18 PM
Need help troubleshooting expression. NitroLiq Programming 4 08-01-2003 01:32 PM