Hi all. First off, put hands up Im a complete noob so go easy on me.
I have a quick question. When you want to use expressions in script editor, how do you get information thats like date -format?
For example, Ive got this which is a part of a clock:
CODE //Used to set the minute hand position.
int $minute = date -format "mm"; int $rotateMinute = $minute * -6; setAttr "minuteHand.rotateZ" $rotateMinute;
The expression is where Im struggling.
CODE //Expression which makes the minute hand move.
expression -o minuteHand -s "minuteHand.rotateZ = $rotateMinute + (time / -10)";
^This is what I want, but the syntax is wrong because of $rotateMinute. It works without a procedure, but with a procedure it doesnt work.
So my question is, how can I replace $rotateMinute in the expression to have real life minutes or is there a way for the expression to access $rotateMinute? Thanks in advance.
joojaa
January 1, 2009, 6:52pm
2
Well simply put you don't. Theres no sane reason to do this but just for humor you could do:
CODE expression -o minuteHand -s "minuteHand.rotateZ =((int)date -format \"mm\" )";
But i think you meant to do:
QUOTE expression -o minuteHand -s ("minuteHand.rotateZ = "+$rotateMinute +"+ (time / -10)");
QUOTE ^This is what I want, but the syntax is wrong because of $rotateMinute. It works without a procedure, but with a procedure it doesnt work.
Your example contains no single procedure.
joojaa
January 1, 2009, 6:54pm
3
Well simply put you don't. Theres no sane reason to do this but just for humor you could do:
CODE expression -o minuteHand -s "minuteHand.rotateZ =((int)date -format \"mm\" )";
or
expression -o minuteHand -s ("minuteHand.rotateZ = "+date -format \"mm\" +"+ (time / -10)");
But i think you meant to do:
QUOTE expression -o minuteHand -s ("minuteHand.rotateZ = "+$rotateMinute +"+ (time / -10)");
QUOTE ^This is what I want, but the syntax is wrong because of $rotateMinute. It works without a procedure, but with a procedure it doesnt work.
Your example contains no single procedure.
Ohhh! I tried something similar to that but my noobishness meant syntax errors.
It works like a charm. Thank you Joojaa, hugely appreciate it!