Set Widget Value Based on Other Widget Values

I am a GPscript newbie, using three different guitar VSTs (Strat, Tele and Les Paul) into a single Amplitube virtual amp VST. I have front-panel button widgets to turn on or off each guitar VST using “bypass” to conserve audio processing when not in use. I want my Amplitube widget to turn on if any of the three guitar VSTs is on, and I want Amplitube off/bypassed if all three guitar VSTs are off. Groups won’t work because they are all on or all off together. I assume the best way to accomplish this is through a script, but I don’t know where to begin. I have read the GPscript user guide and I am familiar with programming languages, just need a code example or two that I can use as a starting point. Thank you in advance.

Here’s a script you can try–

Var
   StratBypass : Widget
   TeleBypass : Widget
   LesPaulBypass : Widget
   AmplitubeBypass : Widget
   A : Double
   B : Double
   C : Double

On WidgetValueChanged(newValue : double) from StratBypass
A = GetWidgetValue(StratBypass)
B = GetWidgetValue(TeleBypass)
C = GetWidgetValue(LesPaulBypass)
    If A == 1.0 and B == 1.0 and C == 1.0
        then SetWidgetValue(AmplitubeBypass,1.0)
    Elsif newValue == 0.0
        then SetWidgetValue(AmplitubeBypass,0.0)
            SetWidgetValue(TeleBypass,1.0)
            SetWidgetValue(LesPaulBypass,1.0)
    End
End

On WidgetValueChanged(newValue : double) from TeleBypass
A = GetWidgetValue(StratBypass)
B = GetWidgetValue(TeleBypass)
C = GetWidgetValue(LesPaulBypass)
    If A == 1.0 and B == 1.0 and C == 1.0
        then SetWidgetValue(AmplitubeBypass,1.0)
    Elsif newValue == 0.0
        then SetWidgetValue(AmplitubeBypass,0.0)
            SetWidgetValue(LesPaulBypass,1.0)
            SetWidgetValue(StratBypass,1.0)
    End
End

On WidgetValueChanged(newValue : double) from LesPaulBypass
A = GetWidgetValue(StratBypass)
B = GetWidgetValue(TeleBypass)
C = GetWidgetValue(LesPaulBypass)
    If A == 1.0 and B == 1.0 and C == 1.0
        then SetWidgetValue(AmplitubeBypass,1.0)
    Elsif newValue == 0.0
        then SetWidgetValue(AmplitubeBypass,0.0)
            SetWidgetValue(TeleBypass,1.0)
            SetWidgetValue(StratBypass,1.0)
    End
End

Remember to name your widgets in the Advanced tab of the Widget Properties.

4 Likes

Thanks!! I’ll give it a go.