Search code examples
syntax-errormayamel

Mel Expression Syntax error


i don't normally script in MEL as my knowledge on it is very limited. I have made a expression however it keeps coming back with

// Error: Line 7.1: Syntax error // 

Here is the expression:

if (global_IkFk_Ctr.L_Arm == 0) {
    l_Bn_ShoulderJnt_01.scaleX == l_Ik_ShoulderJnt_01.scaleX;
    l_Bn_ElbowJnt_01.scaleX == l_Ik_ElbowJnt_01.scaleX;
}

else (global_IkFk_Ctr.L_Arm == 1) {
    l_Bn_ShoulderJnt_01.scaleX == l_Fk_ShoulderJnt_01.scaleX;
    l_Bn_ElbowJnt_01.scaleX = l_Fk_ElbowJnt_01.scaleX;
}

Solution

  • Your else has a condition (global_IkFk_Ctr.L_Arm == 1), which means it needs to be an else if.

    Also, == is used for comparison, but you're trying to use it for assignment. Assignment should be =.

    if (global_IkFk_Ctr.L_Arm == 0){
        l_Bn_ShoulderJnt_01.scaleX = l_Ik_ShoulderJnt_01.scaleX;
        l_Bn_ElbowJnt_01.scaleX = l_Ik_ElbowJnt_01.scaleX;
    }
    else if (global_IkFk_Ctr.L_Arm == 1){
        l_Bn_ShoulderJnt_01.scaleX = l_Fk_ShoulderJnt_01.scaleX;
        l_Bn_ElbowJnt_01.scaleX = l_Fk_ElbowJnt_01.scaleX;
    }