PDA

View Full Version : else if?


fbitonti
09-28-2005, 01:12 AM
This is my script

for ($i = 0; $i < 20; $i = $i + 1)
{
float $curvealgo = sin($i);
float $scale = cos($i);
string $name = "test" + $i;
duplicate -rr;
move -r 0 1.365854 0 ;
scale -r $scale $scale $scale ;
rename ("test" + $i);
print ($name);

string $object = ($name + ".translateY");
float $nameprop = `getAttr $object`;
if ($nameprop >7){
rotate -r -ws 0 0 -89.682647 ;
move -r 2.926829 -5 0 ;
else if ( $nameprop > 0 )
move -r 0 20 0;
}
}

I'm getting the following syntax error

// Error: else if ( $nameprop > 0 )
//
// Error: Syntax error //

obviously i'm not using the comand correctly.

can some one show me how to integrate the else if into the script properly. the mel command referance is'nt much help on this. I realy appreciate all the help i've gotten on this site in the past.

enbee
09-28-2005, 03:01 AM
I think you just need a few more brackets. It needs to know where the if statement starts and stops and same for the else if. The changes I made are in red.

for ($i = 0; $i < 20; $i = $i + 1)
{
float $curvealgo = sin($i);
float $scale = cos($i);
string $name = "test" + $i;
duplicate -rr;
move -r 0 1.365854 0 ;
scale -r $scale $scale $scale ;
rename ("test" + $i);
print ($name);

string $object = ($name + ".translateY");
float $nameprop = `getAttr $object`;
if ($nameprop >7){
rotate -r -ws 0 0 -89.682647 ;
move -r 2.926829 -5 0 ;
}else if ( $nameprop > 0 ){
move -r 0 20 0;
}
}

CGTalk Moderation
09-28-2005, 03:01 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.