View Single Post
# 6 01-06-2003 , 10:39 PM
mark_wilkins's Avatar
Registered User
Join Date: Jan 2003
Posts: 161

translateY = rand (1-9);

The solution can be ALMOST that simple. There's no reason to check the size of the array or loop by index. A for-in loop does that all for you:

Code:
global proc randomTY() {
    string $sel_list[] = `ls -tr -sl`;

    for ($curr_sel in $sel_list) {
        setAttr ($curr_sel + ".ty") (rand(1, 9));
    }
}


-- Mark


Mark R. Wilkins
author of MEL Scripting for Maya Animators
www.melscripting.com