Alright then, if it’s scripting for an assignment you need, I’ll try to give you some tips to get you going.
(as a side note, I’ve not wrote mel for a while so I might have some syntax errors in my examples)
First off, to loop something, I’d use the modulus operator %, the modulus operator works by giving you the remainder of a division operation, so 5 % 2 = 1, 10 % 6 = 4, etc.
You can loop an animation by doing something like this:
$animLen = 24;
$time = currentTime -q
;
$crntFrame = $time % $animLen;
This will give you a repeating sequence of numbers that goes from 0 to 23. You can then use $crntFrame to drive an attribute of an object.
setAttr aLight.translateY, (10 * $crntFrame);
I’d then suggest using expressions to drive the other behaviors you’re seeking. Their syntax is a bit different but they shouldn’t be too difficult to write.
Something like:
if ( sunLight.translateY > 20 )
streetLight.intensity = 1;
else
streetLight.intensity = 0;
If you need to write the expressions from within a script you can use the expression command in mel:
expression -s “aObj.translateX = aShape.translateY”;
If you have more questions, start out by looking at the mel command reference and the resources in Maya’s help files. There’s plenty of examples there that should be able to help guide you on your way.