Page 1 of 1

Using StingConcatenation to set a specific array item

Posted: 06 May 2014 13:31
by electrofux
Can i make the below code work somehow:

Pattern1-8 are expressions in the Container electropolis. The script resides on any of 8 Faders and when i use one of the faders i want to write its x value at the corresponding position in the currently selected Patterns array.

Code: Select all

decl pat='Pattern'+(firstof(electropolis.Pattern.x)+1);
decl pattern=getexpression(electropolis,pat);
pattern[1]=x;
setexpression(electropolis,'pat',pattern);

Thought i first define the name of the expression, then get the expression and write it in pattern, then alter pattern at the right position and then set the expression to the altered array. But it doesnt work.

Re: Using StingConcatenation to set a specific array item

Posted: 07 May 2014 10:42
by electrofux
Phew, got it. Only some ' were too much:

Code: Select all

decl pat='Pattern'+(firstof(electropolis.Pattern.x)+1);
decl pattern=getexpression(electropolis,pat);
pattern[nr]=x;
setexpression(electropolis,pat,pattern);
This worked.