LC #42 Pipers Alley

View Full Version : Two expression questions

06-17-2003, 05:17 PM

I am trying to learn Maya expression, and I have two embarassing questions to ask. I hope they're not too basic, but I am having trouble finding the solution in the documentation. Also, my english isn't that great, so I sometimes can't find the exact english synonym to what I'm searching for.

Is there a way I can include two conditions for each step inside an if...else?

Say I want something to occur at frame intervals; something from frame 20-55, then something from frame 56-61, and so on. There doesn't seem to be a way of saying "if (frame >56 and <61) {then..." Is there some other way to do this?

How can I put a variable inside an attribute? If I have ten cameras, each named cam01, cam02 etc - can I do something like this:
box.translateX = cam[number].translateX ??

I am new to programming, so please have mercy!


06-17-2003, 06:59 PM

if ((frame > 20) && (frame<30))
will only execute between frame 20 and 30


for ($i=1; $i<=10; $i++)
string $tmp;
if ($i<10)
$tmp = "0"+$i; // doing the padding.. would be obsolete without padding
$tmp = $i;

box.translateX = ("cam"+$tmp+".translateX");

you may wanna check the mel manuals again :)



06-17-2003, 07:18 PM
Yes, great!! Thanks a million, Alex!

It feels like I've been skimming through tons of manual pages , and I haven't seen hints of these - but I might have been looking for the wrong things.

Thanks again!


CGTalk Moderation
01-15-2006, 11:00 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.