one set of 14 buttons, toggle mode (differents backgrounds depending on button's value)
one 14 value's switch (same thing with backgrounds).
First questions (more to come ):
i know how to turn off a button, using another one. But in this case, i need each button to turn off the 13 others... Or at least the one that would have been turned on just before... In one word : i need my 14 buttons to act like a switch... How can i do that ?... I can imagine a few things, but i'm too new to OSC to script this...
You can try it out by inserting the following script on your first button, I will call it button_1 for this example:
//1 is the value of button_1
if (value == 1) {
//When button_1 is toggled, button_2 and button_3 will turn off
set ("button_2", 0)
set ("button_3", 0)
//etc...
}
Isn't there a way to make it shorter ?... Like some syntax that would mean "get all the other buttons in this panel and set them all to zero" (using a variable, especially if their names have a number).
Probably what you could do is to create a button outside of the panel, which I guess has already 14 buttons ?
In any case, that external button will switch all the buttons you have in the panel to on/off when you toggle it and this can be done by using linkId.
That's the shortest solution I can think of right now but if something else pop up I will let you know !
Like some syntax that would mean "get all the other buttons in this panel and set them all to zero" (using a variable, especially if their names have a number).
So i've some buttons in the same panel, b2 and b3 (in fact, i have a bit more of them):
In their "script menu" : set("b*",0, {sync:false});
b2 turns of b3, and b3 turns off b2, that seems to be ok as the widgets alpha changes.
Here I have two text widgets set to value : @{b2} for the first one, value : @{b3} for the second one.
Values changes are shown as expected when buttons are turned of/off individually.
But...
The thing is that when a button is turned off by another, it's value appears to stay "1" as show the text widget...
Also, if i try with two background images for each button, using in css field :
the background change is made when i press the button, but as soon as the other button is turned on, the background image of the first one stays the same, on "image ON"...
Hope i'm clear... so... what's wrong here ?... do i misunderstand anything ? or is there something not working ?
This works great... however, when I add a midi target:
"midi:loopbe" in the "osc -> target" field, the buttons wont stay "active / toggled" when i press them (they become unpressed immediately).
What could be causing that?