Increment component name?

Recommended Posts


I'm new here, I searched the forum but didn't find what I was looking for. Hope you can help me.

I want to be able to change a component property for multiple components like this:







but I have 128 of them and wouldn't like to have to write each assignement one by one.. Is there a way I can do this using a for-loop or something like that? Or could you perhaps propose another solution to my problem?

Hope that my question is clear.

Thank you in advance

Link to comment
Share on other sites

Your question is clear, as is the answer: use the execute() function and create the command string dynamically. Something like this:

for (private i = 1, i < 128, i++)
   execute("component.comp" + i + ".visible=V.compcount[" + 128-i)

Note that since I start with a string, I don't have to use doubleToStr() to convert the numbers, the string concatenation operator handles it.

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.