Lemur : script to change text color ?

Dollismine

New Member
Hello,

What is the script to change the text color in an object (custombutton with switch mode, so I need color for On statut and Off statut) ?

Thanks !
:)
 

pmcrockett

Senior Member
Code:
setattribute(CustomButton, 'color', {RGB(0,0,0), RGB(1,1,1)});
Replace CustomButton with the name of the specific button if it's different. RGB numbers indicate red, green, and blue on a scale from 0 to 1. The first RGB sets the off color; the second sets the on color. (This code will set off to black and on to white).
 
OP
D

Dollismine

New Member
...and if I want to activate a switch from other switch ?
I mean : if Pad A is On, then Pad B is On

I try with setattribute but I think it's not the good approach

(sorry, I don't know scripting...)
 
OP
D

Dollismine

New Member
OK, found !! :2thumbs:
if (TogglePiccolo.x==1) setexpression (ToggleWoodwinds,'x',1);
if (TogglePiccolo.x==0) setexpression (ToggleWoodwinds,'x',0);

Probably not a clean code, but this is my 1rst !

My goal is "if Piccolo switch or Flute switch or Clarinet or etc etc are ON, then WoodWinds switch is ON" If not, Woodwinds switch is OFF

I thik there is a better function than create 20 line od code !
 
Last edited:

pmcrockett

Senior Member
Create a script in ToggleWoodwinds named Sync(), set its execution to Manual, and paste this code into it:
Code:
if (TogglePiccolo.x || ToggleFlute.x || ToggleClarinet.x) x = 1;
else x = 0;
Then in each of the other buttons, create a script named OnX(), set its execution to On Expression x, and paste this into it:
Code:
ToggleWoodwinds.Sync();
Now every time the state of one of the buttons changes, ToggleWoodwinds will check all of the buttons and update itself.

The Sync() script can be expanded by adding whatever other buttons you want to check into the if statement after a || symbol. The || symbol means or; the if statement is checking whether any of the buttons' x values are non-zero.
 
OP
D

Dollismine

New Member
Perfect !
Thanks for your time and explanation. Very Clear !
It allows me to understand what the script do !
:2thumbs: