jibadajaba
03-25-2012, 06:16 PM
Hello, I'm new to mel and am just starting the DVD from gnomon for introduction to mel.
However, I'm perplexed by a simple conditional...example that he gave. Seemed to work for him but not for me. I can get conditionals to work in other ways but not this particular string. Any insight would be greatly appreciated.
First off he created a polySphere
then ran the string
//scaleZ is a variable
float $scaleZ = `getAttr pSphere1.scaleZ`;
//change the color to red when $scaleZ bigger than 2
if ($scaleZ > 2);
setAttr "lambert1.color" 1 0 0;
else
setAttr "lambert1.color" 0 0 1;
The error I get is "// Error: else //
// Error: Syntax error //"
I can run each section individually, but when running the conditional things seem to run into a snag with "else." Any thoughts? Also, I also tried it with the {} before the setAttr lines. Didn't work this way either. I'm sure I'm missing something pretty simple.
Thanks in advance. When learning mel, you got to just love syntax.
However, I'm perplexed by a simple conditional...example that he gave. Seemed to work for him but not for me. I can get conditionals to work in other ways but not this particular string. Any insight would be greatly appreciated.
First off he created a polySphere
then ran the string
//scaleZ is a variable
float $scaleZ = `getAttr pSphere1.scaleZ`;
//change the color to red when $scaleZ bigger than 2
if ($scaleZ > 2);
setAttr "lambert1.color" 1 0 0;
else
setAttr "lambert1.color" 0 0 1;
The error I get is "// Error: else //
// Error: Syntax error //"
I can run each section individually, but when running the conditional things seem to run into a snag with "else." Any thoughts? Also, I also tried it with the {} before the setAttr lines. Didn't work this way either. I'm sure I'm missing something pretty simple.
Thanks in advance. When learning mel, you got to just love syntax.
