looping through custom lists
I would really appreciate some help here.
I have created this script to highlight visible tracks. At the moment it’s divided in two reactions triggered by buttons.
One is creating a list of visible tracks – this works ok and returns the correct track numbers.
The other reaction loop through the list and is meant to update the modifiers (M1 to M8).
However all modifiers are given the same value (0).
I am using these lines to update the modifiers (please note that I have to add 1 to the loop number as it appears that custom list index is 1 and not 0):
self.set_modifier_value(“m1”, self.get_list_item(“list1”, loop_number +1))
self.set_modifier_value(“m2”, self.get_list_item(“list1”, loop_number +1))
etc
Now I would expect the loop number to increase with every iteration, but is it not?
The loop is in the same block as the action….
Hi,
Are you referring to the reaction named “update modifiers” in your attached script?
If so, you’re setting all of the modifiers to the same value with each loop iteration.
You should have 1 action and update the modifier name each time:
self.set_modifier_value(“m” + loop_number, self.get_list_item(“list1”, loop_number +1))
However, you may run into errors if you try to save to modifiers greater than m20, so I’d recommend add a condition in which checks that the loop number is less than or equal to 20.
Sign up
User registration is currently not allowed.