I'm attempting 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

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 Zif(R_FK_Shoulder_CTRL.rotateZ != 0) {// if there is rotation in Z, check if there is rotation in Xif(R_FK_Shoulder_CTRL.rotateX !=0) {//if there is rotation in X, then ik handle roll = rotateX / -2AO_R_BendArm_ikHandle01.Roll == R_FK_Shoulder_CTRL.rotateX /-2}// if there is no Rotation in X, then Roll = 0else {AO_R_BendArm_ikHandle01.Roll == 0}} // if there was no rotation in Z in the first place, check if there is rotation in Yelse { if(R_FK_Shoulder_CTRL.rotateY != 0) {// if there is Rotation in Y, check if there is Rotation in Z after Yif(R_FK_Shoulder_CTRL.rotateZ != 0) ;// if there is Rotation in Z after Y, Roll = rotateZ / -2AO_R_BendArm_ikHandle01.Roll == R_FK_Shoulder_CTRL.rotateZ /-2;

//check if there is rotation in Zif(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 Yelse { 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};}

Maya says I have a syntax error at Line 19.1 but I don't understand what I've done wrong.

I edited the code from your first post. As you mentioned, you need single '=' signs to assign values.

There were a few issues, some extra ';' and missing curly brackets.

You also have 2 'else' statements in a row. You can't do that - you need to use 'else if' if you want multiples. Only the last one can be 'else'.

I've added a comment as text below (which will be 'yellow' if you paste into the Script Editor), which you NEED TO DELETE before running.

I haven't looked at MEL for a while, but hopefully this works...

Code:

//check if there is rotation in Zif(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, then ik handle roll = rotateX / -2 AO_R_BendArm_ikHandle01.Roll = R_FK_Shoulder_CTRL.rotateX /-2; } // if there is no Rotation in X, 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 Yelse 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;

I edited the code from your first post. As you mentioned, you need single '=' signs to assign values.

There were a few issues, some extra ';' and missing curly brackets.

You also have 2 'else' statements in a row. You can't do that - you need to use 'else if' if you want multiples. Only the last one can be 'else'.

I've added a comment as text below (which will be 'yellow' if you paste into the Script Editor), which you NEED TO DELETE before running.

I haven't looked at MEL for a while, but hopefully this works...

Code:

//check if there is rotation in Zif(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, then ik handle roll = rotateX / -2 AO_R_BendArm_ikHandle01.Roll = R_FK_Shoulder_CTRL.rotateX /-2; } // if there is no Rotation in X, 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 Yelse 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;

Who is online

Users browsing this forum: No registered users and 0 guests

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum