Hello,
I got a timer that countdown. I'd like to create a button that I can toggle on or off and that if the button is toggle on, when the timer hit 0:30, it will trigger an action.
I managed to do so but it only work if I push my button exactly when the clock show 0:30. It doesn’t work if I hit the button prior to 0:30 and then wait 'til the clock go down to 0:30…
I’m sure it’s quite simple but I can’t figure it out so if I can get help, it would be much appreciated.
Thanks
Hi Guillaume,
Here is a panel with a toggle parameter, and a timer that counts down from 10s. When it hits 5 seconds, it prints out something on the console, if the parameter is toggled on.
params.setValue('time', 0, event.getDisplay());
timer = ogscript.getTimerManager().getTimer('Countdown');
if (timer.getCurrent() == 5000 && params.getValue("toggle",0) == 1) {
ogscript.debug("SOMETHING HAPPENED AT 5 SECONDS");
}
Do Not Do Action
Do Action at 5s
ogscript.getTimerManager().getTimer('Countdown').startTimer(true);
Let me know if you have further questions.
#DashBoard