Page 1 of 1
On-State Multicolor
Posted: 08 Jun 2013 15:26
by somethingnew
Hi,
wondering if it a way to have a switch object say with 4 switches, and have multicolor assigned to them, but to ON state?
see image,
I want switches to be in Radio Mode, and all to be grey colored, so when I select any one of them, they should turn on with the colors defined by me.
- Screen shot 2013-06-09 at 1.24.57 AM.png (56.66 KiB) Viewed 3132 times
Re: On-State Multicolor
Posted: 09 Jun 2013 15:55
by Softcore
Interesting circumstance.....
There is no multi-on color option for the switches - multicolor refers to off states....
So there are two possible apporaches:
1. The convenience that you want radio buttons (only one switch on at any given time) means we can get away by scripting changes of on state color (even if it means for ALL the buttons only one will be visible and have the specified color). This approach goes messy of course if you disable "radio"....
2. What if we didnt want radio but did want different on colors? wellll, multicolor attribute helps with the off colors so we can just use an inverted x expression as output (out=1-x) and thus treat our switches as if the "on" color is the off (all grey) and the off color is the "on" (multicolor scripting will take it care)
Re: On-State Multicolor
Posted: 11 Jun 2013 11:28
by somethingnew
Thanks Softcore !!
it was the first solution that I was looking for
radio mode !!
thanks !!
Re: On-State Multicolor
Posted: 11 Jun 2013 11:59
by Softcore
I just noticed something in your image.....
Definitely make the scripts onLoad and not onFrame - you dont want precious cpu cycles wasted with an onframe script (which will be continuously executed) for something you only need to set once, when the template loads.
Re: On-State Multicolor
Posted: 12 Oct 2016 06:53
by joebataz
"so we can just use an inverted x expression as output (out=1-x) and thus treat our switches as if the "on" color is the off (all grey) and the off color is the "on" (multicolor scripting will take it care)"
What?
I have 8 switches (Remotes), I have a multi-slider (ColorSelect 3 sliders R,G,B) and a single pad (CurColor)
ColorSelect is to mix a color and put it in the ON color of CurColor
setattribute(CurColor,'colors',{RGB(x[0],x[1],x[2])});
As I flip switches (Remotes) I want to put CurColor into the OFF color of Remotes. Right now when a switch flips, ALL the switches turn the same color:
decl onColor;
onColor = getattribute(CurColor,'colors');
if (x[0] == 1) setattribute(REMOTES, 'color', {0, onColor});
if (x[1] == 1) setattribute(REMOTES, 'color', {0, onColor});
if (x[2] == 1) setattribute(REMOTES, 'color', {0, onColor});
if (x[3] == 1) setattribute(REMOTES, 'color', {0, onColor});
if (x[4] == 1) setattribute(REMOTES, 'color', {0, onColor});
if (x[5] == 1) setattribute(REMOTES, 'color', {0, onColor});
if (x[6] == 1) setattribute(REMOTES, 'color', {0, onColor});
if (x[7] == 1) setattribute(REMOTES, 'color', {0, onColor});
TIA fr any suggestions!
Best,
joeb
Re: On-State Multicolor
Posted: 12 Oct 2016 19:05
by MrCorba
I don't really get your question... Can you post a project with some code?
Maybe then I can help you
Re: On-State Multicolor
Posted: 14 Oct 2016 06:02
by joebataz
Thanks for the response!
Posting the app would be a chore. It's like 80% on the little green pie chart.
Let me state it more simply; get the color of an object, set the background (OFF) color of a multi color switch in a switches object to the color of the object.
Thanks again,
Joe B