Thank you Colin this works great.
However when I add in a stop button for the operator to manually stop the clock, when the clock is stopped and then started again the timeToStop moves on to the next timeToStop.
In your example the first time to stop is 00:05. If I was to manually stop the clock before it reaches that time, say 00:03 and then start it again the timeToStop changes to 00:10.
Is it possible for the timeToStop remain at 00:05 even after I stop and start the clock?
Thanks again for your help
Here is my DashBoard if that helps.
<abs contexttype="opengear" id="_top" keepalive="false">
<button buttontype="push" height="80" id="start.timer.button" left="43" name="Start Clock" style="bg#009D02;size:22;" top="21" width="160">
<task tasktype="ogscript">ogscript.debug( "START" );
var timeToStop = params.getValue( "timer.to.stop", 0 );
if ( timeToStop == "00:00" ){
timeToStop = "00:05";
}else if( timeToStop == "00:05" ){
timeToStop = "00:10";
}else if( timeToStop == "00:10" ){
timeToStop = "40:00";
}else{
timeToStop = "never";
}
params.setValue( "timer.to.stop", 0, timeToStop );
ogscript.getTimerManager().getTimer("mytestClock").startTimer( false );
ogscript.hide( "start.timer.button" );
ogscript.reveal( "stop.timer.button" );</task>
</button>
<abs height="139" left="59" top="220" width="281">
<param expand="true" height="60" left="79" oid="gameclock" style="style:timerLabel;size:40;txt-align:center;" top="41" width="180"/>
<button buttontype="push" height="60" left="19" name="R" style="size:26;bg#830000;look:normal;txt-align:south;" top="40" width="60">
<task tasktype="ogscript">params.setValue( "timer.to.stop", 0, "00:00" );
ogscript.getTimerManager().getTimer("mytestClock").stopTimer( false );
ogscript.getTimerManager().getTimer("mytestClock").resetTimer;
ogscript.reveal( "start.timer.button" );
ogscript.hide( "stop.timer.button" );</task>
<task tasktype="timercontrol">ogscript.getTimerManager().getTimer('mytestClock').resetTimer();</task>
</button>
<button buttontype="push" flat="true" height="28" left="103" name="▲" top="7" width="28">
<task tasktype="timercontrol">ogscript.getTimerManager().getTimer('mytestClock').incrementTime(600000);</task>
</button>
<button buttontype="push" flat="true" height="28" left="134" name="▲" top="7" width="28">
<task tasktype="timercontrol">ogscript.getTimerManager().getTimer('mytestClock').incrementTime(60000);</task>
</button>
<button buttontype="push" flat="true" height="28" left="174" name="▲" top="7" width="28">
<task tasktype="timercontrol">ogscript.getTimerManager().getTimer('mytestClock').incrementTime(10000);</task>
</button>
<button buttontype="push" flat="true" height="28" left="205" name="▲" top="7" width="28">
<task tasktype="timercontrol">ogscript.getTimerManager().getTimer('mytestClock').incrementTime(1000);</task>
</button>
<button buttontype="push" flat="true" height="28" left="205" name="▼" top="104" width="28">
<task tasktype="timercontrol">ogscript.getTimerManager().getTimer('mytestClock').incrementTime(-1000);</task>
</button>
<button buttontype="push" flat="true" height="28" left="174" name="▼" top="105" width="28">
<task tasktype="timercontrol">ogscript.getTimerManager().getTimer('mytestClock').incrementTime(-10000);</task>
</button>
<button buttontype="push" flat="true" height="28" left="134" name="▼" top="104" width="28">
<task tasktype="timercontrol">ogscript.getTimerManager().getTimer('mytestClock').incrementTime(-60000);</task>
</button>
<button buttontype="push" flat="true" height="28" left="103" name="▼" top="104" width="28">
<task tasktype="timercontrol">ogscript.getTimerManager().getTimer('mytestClock').incrementTime(-600000);</task>
</button>
</abs>
<button buttontype="push" height="80" id="stop.timer.button" left="59" name="Stop Clock" style="bg#830000;size:22;txt-align:center;" top="100" width="160">
<task tasktype="timercontrol">ogscript.getTimerManager().getTimer('mytestClock').stopTimer(false);</task>
<task tasktype="ogscript">ogscript.hide( "stop.timer.button" );
ogscript.reveal( "start.timer.button" );</task>
</button>
<meta>
<params>
<param access="1" maxlength="0" name="timer.to.stop" oid="timer.to.stop" type="STRING" value="00:10" widget="default"/>
<param access="1" maxlength="0" name="gameclock" oid="gameclock" type="STRING" value="00:03" widget="label"/>
</params>
</meta>
<timer autostart="false" id="mytestClock" pattern="mm:ss" rate="1000" start="00:00" stop="90:00">
<timertask tasktype="ogparamset">params.setValue('gameclock', 0, event.getDisplay());</timertask>
<timertask tasktype="ogscript">//
var time = event.toString();
var timeToStop = params.getValue( "timer.to.stop", 0 );
if ( time == timeToStop){
ogscript.debug( "first point reached ............................." + timeToStop );
ogscript.getTimerManager().getTimer("mytestClock").stopTimer( false );
ogscript.reveal( "start.timer.button" );
return;
}
ogscript.debug( "Updated: " + time );</timertask>
</timer>
<button buttontype="push" height="3" left="286" top="455" width="1"/>
<param expand="true" height="43" left="235" oid="timer.to.stop" showlabel="false" top="144" widget="label" width="259"/>
<label height="46" left="233" name="Time to Stop" style="txt-align:west;" top="102" width="283"/>
</abs>
#DashBoard