Button return opposite value for popup
-
Hey Gang,
I have a button controlling a popup. Right now, when the button turns on, the popup appears. Great. Now, how do I make this return the opposite (when button is on, popup is off)?
Here is my current script for this
const var DelayBlackoutimg = Content.getComponent("DelayBlackoutimg"); inline function onDelayPowerbtnControl(component, value) { DelayBlackoutimg.showControl(value); Content.getComponent("DelayPowerbtn").setValue(value); }; Content.getComponent("DelayPowerbtn").setControlCallback(onDelayPowerbtnControl);
-
@trillbilly Use the invert/not operator
!
DelayBlackoutimg.showControl(!value);
-
@d-healey Well I'll be a son of a gun...
Thank you
-
@trillbilly said in Button return opposite value for popup:
@d-healey Well I'll be a son of a gun...
Thank you
or for those times where you are not using logical operators
DelayBlackoutimg.showControl(1 - value);
or you want the result to filp between 1 and minus 1:
myVal = (value*2)-1;