On-State Multicolor

Discuss problems and solutions.
Post Reply
somethingnew
Newbie
Posts: 9
Joined: 22 May 2013 13:02

On-State Multicolor

Post 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
Screen shot 2013-06-09 at 1.24.57 AM.png (56.66 KiB) Viewed 3111 times
Softcore
Regular
Posts: 1613
Joined: 04 Nov 2012 08:34

Re: On-State Multicolor

Post 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"....
radio-oncolors.jzml
(2.39 KiB) Downloaded 167 times
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)
fullcompatible-oncolors.jzml
(1.77 KiB) Downloaded 149 times
somethingnew
Newbie
Posts: 9
Joined: 22 May 2013 13:02

Re: On-State Multicolor

Post by somethingnew »

Thanks Softcore !!
it was the first solution that I was looking for :) radio mode !!

thanks !!
Softcore
Regular
Posts: 1613
Joined: 04 Nov 2012 08:34

Re: On-State Multicolor

Post 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.
joebataz
Regular
Posts: 154
Joined: 28 Feb 2012 16:50
Location: Anthem, AZ USA
Contact:

Re: On-State Multicolor

Post 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
MrCorba
Regular
Posts: 142
Joined: 02 Sep 2013 20:17
Location: Netherlands

Re: On-State Multicolor

Post by MrCorba »

I don't really get your question... Can you post a project with some code?

Maybe then I can help you
"Having no silence in music is like having no black or white in a painting" - Brian Eno
https://soundcloud.com/mrcorba
joebataz
Regular
Posts: 154
Joined: 28 Feb 2012 16:50
Location: Anthem, AZ USA
Contact:

Re: On-State Multicolor

Post 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
Post Reply