Penalty Clocks

I’m working on a hockey interface for use with Xpression. I have timers set up for penalties, and I have made them children of the main timer. Each timer has buttons to quickly add 2min, 4min, 5min or reset to 0.

So the issue is, the timers default to 5min on startup. Not a huge deal, the operator can easily reset the clocks before the game begins. However, I’m dreading the day when a green operator comes in and starts the game and all 5 clocks appear on air.

I have included a “reset all” button which clears all the fields and resets all the clocks, but for some reason this sometimes freezes Xpression.

So I’m trying to find a solution where the clocks default to zero on startup. Obviously I’ve tried just setting the start time to 0, but then they just start counting up instead of down.

Here is the code I have on my start button (integer, choice constraint, toggle button widget)

var penTimer1 = ogscript.getTimerManager().getTimer(‘Home Pen 1’);

var penTimer2 = ogscript.getTimerManager().getTimer(‘Home Pen 2’);

var penTimer3 = ogscript.getTimerManager().getTimer(‘Away Pen 1’);

var penTimer4 = ogscript.getTimerManager().getTimer(‘Away Pen 2’);

var periodTimer = ogscript.getTimerManager().getTimer(‘Period’);

// When timer is stopped

if (this.getValue() == ‘0’){

periodTimer.stopTimer(false);

// When timer is started

}

if (this.getValue() == ‘1’) {

penTimer1.startTimer(false);

penTimer2.startTimer(false);

penTimer3.startTimer(false);

penTimer4.startTimer(false);

periodTimer.startTimer(false);
Anyone have any ideas? Any help is appreciated. Thanks!

I think the biggest question to resolve is why/how your reset all button is able to freeze XPression.

Once that is sorted, you should be able to put your reset code into an ... block.

I assume your reset button is just trying to call penTimer1.setTime(0); penTimer2.setTime(0); …?

#DashBoard

Hi James,

Yes, you’re right, I’m working on sorting out this Xpression issue.

I believe it has something to do with the penalties. Each of the timers has code that determines whether to display “powerplay” or “4 on 3” etc, along with the time with the lowest value. Then in Xpression, i have some scripts that will hide and show layers depending on those values. So something is happening there when all those values are reset. Anyway, I’m working on it :slight_smile:

Can you tell me more about the block? Where in the document does this go? meta?

Thanks again

#DashBoard

It goes in the meta. It would look something like this:

`

var penTimer1 = ogscript.getTimerManager().getTimer(‘Home Pen 1’);

var penTimer2 = ogscript.getTimerManager().getTimer(‘Home Pen 2’);

var penTimer3 = ogscript.getTimerManager().getTimer(‘Away Pen 1’);

var penTimer4 = ogscript.getTimerManager().getTimer(‘Away Pen 2’);

penTimer1.setTime(0);

penTimer2.setTime(0);

penTimer3.setTime(0);

penTimer4.setTime(0);

`
#DashBoard