Too many arguments in {}-brackets

Discuss problems and solutions.
Post Reply
Stevie
Newbie
Posts:14
Joined:12 Nov 2015 00:53
Too many arguments in {}-brackets

Post by Stevie » 30 May 2017 11:20

Hey all,

I have an if-clause to turn off about 60 buttons with one single button. However, I cannot add all the buttons that need to be turned off.
The script font turns red and the editor doesn't accept any characters anymore. Does anyone have an idea how to workaround this?

I already tried a for-loop with an array: https://forum.liine.net/viewtopic.php?f=34&t=3125
But this one also uses {}-brackets and fails when adding more conditions.
Creating a second script inside the button doesn't work either.

Any help appreciated!

schoko
Newbie
Posts:38
Joined:07 Feb 2015 17:54

Re: Too many arguments in {}-brackets

Post by schoko » 31 May 2017 17:56

Hi,

you have a limit space (chars) per array.
Thanks to the limitation (255 Elements, and limited chars per array), i use arrays in arrays.
I have a Container, lets call it DatArr
under DatArr you make the main array where you can store up to 255 elements.
[DatArr]
DEV={DEV1,DEV2,...}
DEV1={DE1,DE2,DE3,DE25}
DEV2={DE26,....}
DE1={yourCustomString1}
DE2={yourCustomString}


With such a data structur you can say:
getexpression(findobject('DatArr'),'DE' + i); i is a variable in a loop for example this will give you "yourCustomString1"

In your case i would use a stepswitch and input something like the above array structure (0,1 instead of strings) via setattribute (or expression, you have to look into the manual).

regards
schoko

Stevie
Newbie
Posts:14
Joined:12 Nov 2015 00:53

Re: Too many arguments in {}-brackets

Post by Stevie » 31 May 2017 18:17

Hey schoko,

thanks, that's a great hint, I will try that!
But what just came into my mind. Since the buttons I want to de-activate have all similar names, would it also be possible to do the following:

I have 16 switches called:

Switch_Select_16th_Note_01
Switch_Select_16th_Note_02
Switch_Select_16th_Note_03
....

is it possible to do this? (pseudo code):

i = 0
for (i < 15)
Switch_Select_16th_Note_i.x=0


Cheers,

Stevie

schoko
Newbie
Posts:38
Joined:07 Feb 2015 17:54

Re: Too many arguments in {}-brackets

Post by schoko » 31 May 2017 18:38

no, that will not work in that way.

a switch can be 16 rows x 16 columns
you have 16 rows via setattribute or manually

then you can say switch.x = {0,0,0,0,0,0,0...}
you can say "switch" is a container and x the expression, so you can do a getexpression of "x" for reading out the state of the buttons..., or just "zzz = switch.x"
i am not sure but i think you can also do
switch.x = 0 (iterate through them, i can't try it out now)

you don't need 16 switches, just one with 16 rows (or columns)...

i suggest read and search the forums ;-)

regards
schoko

Stevie
Newbie
Posts:14
Joined:12 Nov 2015 00:53

Re: Too many arguments in {}-brackets

Post by Stevie » 31 May 2017 19:26

Hey Schoko,

yes I know :D I tried the 16 columns version, but there was an issue which I couldn't solve.
Believe me, I searched the whole forum about it :lol:

That's what my switches look like:
Screenshot 2017-05-31 21.19.44.png
Screenshot 2017-05-31 21.19.44.png (12.27KiB)Viewed 1687 times
The first 3 are turned on. Each of them is a toggle and has the following code, whereas the controller increments for every switch:

Code: Select all

if (!PadSelectPattern.x)
{
ctlout(0,64,127,3);
ctlout(0,21,127,3);
}
The switches send the same command when turning them on or off.
And there's the reset-button "SelectPattern", that will turn off all switches BUT without executing the ctlout. That was the tricky part.

"SelectPattern" has the followind code:

Code: Select all

ContainerSelectNotesInBars.SwitchSelect_16th_Note01.x=0;
ContainerSelectNotesInBars.SwitchSelect_16th_Note02.x=0;
ContainerSelectNotesInBars.SwitchSelect_16th_Note03.x=0;
ContainerSelectNotesInBars.SwitchSelect_16th_Note04.x=0;
ContainerSelectNotesInBars.SwitchSelect_16th_Note05.x=0;
ContainerSelectNotesInBars.SwitchSelect_16th_Note06.x=0;
ContainerSelectNotesInBars.SwitchSelect_16th_Note07.x=0;
ContainerSelectNotesInBars.SwitchSelect_16th_Note08.x=0;
ContainerSelectNotesInBars.SwitchSelect_16th_Note09.x=0;
ContainerSelectNotesInBars.SwitchSelect_16th_Note10.x=0;
ContainerSelectNotesInBars.SwitchSelect_16th_Note11.x=0;
ContainerSelectNotesInBars.SwitchSelect_16th_Note12.x=0;
ContainerSelectNotesInBars.SwitchSelect_16th_Note13.x=0;
ContainerSelectNotesInBars.SwitchSelect_16th_Note14.x=0;
ContainerSelectNotesInBars.SwitchSelect_16th_Note15.x=0;
ContainerSelectNotesInBars.SwitchSelect_16th_Note16.x=0;
I'll check again which problem I had with the switch array and report back.

Stevie
Newbie
Posts:14
Joined:12 Nov 2015 00:53

Re: Too many arguments in {}-brackets

Post by Stevie » 31 May 2017 21:46

I remember the issue now...
I'm using the switches in non-Radio mode. A switch array makes it impossible to press buttons independently. Let's say you press button 1 and keep it activated.
Then you press button 2 but this one still triggers the function on button 1, until you deactivate it. But it's cruicial to keep
all pressed buttons on, until I press the reset button.

Stevie
Newbie
Posts:14
Joined:12 Nov 2015 00:53

Re: Too many arguments in {}-brackets

Post by Stevie » 31 May 2017 21:52

Okay, I found solution, apparently this script here did the trick!
https://liine.net/en/community/user-library/view/152/

Okay, changing everything to a switch-array now :D


EDIT: okay, now I have a different problem. I cannot use 2 or 3 fingers to trigger 3 buttons simultenously, is there a workaround for that?

Post Reply