Understanding arrays in Scriptlets

Hi Scripters,

some more questions for today - I have not been able to understand this completely :thinking:

I was trying to build some functions which I wanted to make use of For loops for a number of Parameters in a Scriptlet.

Basically I defined some parameters representing some Pads on my KeyLab MkII:
Bildschirmfoto 2022-12-04 um 15.51.12

I can access in a On ParameterValueChange an react with pad_i:

Question 1: is there a more elegant way to write down the matching pad_1, ... pad_16?

I also tried to do a initial MIDI dump with a For loop (the part currently commented out…):
Bildschirmfoto 2022-12-04 um 15.55.34

Question 2: How do I access the pad_N parameters within the For loop?
My current ‘workaround’ is to provide 16 lines of code for this…

Brain blocked for today :crazy_face:


OK, forget about Question 2: Already did this in a different script, but forgot about it :scream:
Put them all in a new array…

Bildschirmfoto 2022-12-04 um 16.19.37

Now I can access them:

BBB - back to Glühwein :sunglasses:

I would strongly encourage you to write

for i = 0; i < Size(pads) ....

rather than
for i = 0; i < 16 …