View Single Post
# 1 09-02-2012 , 10:42 PM
Registered User
Join Date: Feb 2012
Posts: 1

"Variable variable names"?

I'm writing an expression to take care of a "chasing lights" effect. Each row of lights has its own surfaceShader, and the expression uses a sine wav to bring the lights' outColor up and down. So far so good.

The problem I'm encountering now is that I want to use a for loop to set each of the surfaceShaders with one expression. The loop works fine, but I have yet to figure out how to use the loop counter to "generate" the surfaceShader name, then feed that into an assignment statement.

Example: let's say I need to assign 1 to outColorR on 5 nodes, named testLight0, testLight1, ..., testLight4. Like this:

for ( $i =0; $i < 5, $i++) {

[?????].outColor = 1;
}

I've tried concatening $i to the end of a "testLight" string with the + operator, and no luck. Any ideas?
All I really need to know is how to turn a string into a reference to a node , I have the rest figured out.