I’m certain the answer to this is simple, but I’ve got a basic panel that has two buttons and a USB game controller hooked up. When either button 1 or 2 on the game controller is pressed, I want the button background in Dashboard to be red. When it’s not pressed, it should be green. I have it working except for the fact that I have to click on “Apply Changes” in the component editor to see the Dashboard buttons update. How do I set it to constantly listen and respond instantly to changes on the game controller? Script is below, thanks in advance for any help!!
/! block id=1114,1130,1115,1131 !/
switch (params.getParam(‘DB-Joystick.1’, ‘params.joy.button.1.mappings.0.value’, 0).getValue())
{
case 0:
ogscript.setStyle(“BUTTONB”, “bg#green;”);
break;
case 1:
ogscript.setStyle(“BUTTONB”, “bg#red;”);
break;
}
/! block id=1134,1133,1135,1136 !/
switch (params.getParam(‘DB-Joystick.1’, ‘params.joy.button.0.mappings.0.value’, 0).getValue())
{
case 0:
ogscript.setStyle(“ButtonA”, “bg#green;”);
break;
case 1:
ogscript.setStyle(“ButtonA”, “bg#red;”);
break;
}
/!!
!!/
/!!c0a075b8c55e3b386d29ef301a45d0d8!!/