Jump to content

Timer not stopping. Is this a known 'feature'?


Recommended Posts

I've got a timer with a 1 second interval. Each time it triggers it increments a variable and compares it to a maximum allowable value. If the variable is greater then or equal to maximum value I do a call to stop the timer, play an audio file and show a messagebox

However, my call to stop the timer is being completely ignored (when testing the the Groundspeak emulator)

Is this a known issue?

Is is simply that I shouldn't try and stop a timer in the trigger event?


I've done a work-around but it's not very nice.





Link to comment

Yes, this is a veeeeeeeeeeeery old known issue and I prefer the same as Ranger Fox using a variable and if the final value is reached not yet, I start the countdown (1 second) again. B


But in some cases I already have used an intervall timer. Here it is important to set the actions NOT in the "On elapse", but in the "On start" trigger event.

Edited by jonny65
Link to comment

If I'm right, than this is only a problem on Garmins and the Emulator. There is a bug in the code, which don't check, if you stopped the timer in the OnTick event.


You could use the following function and copy it to your author script.


function Wherigo.ZTimer.Tick(self)
 if self.Running then
   self.Stopped = false
   if self.Type ~= ""Interval"" then
     self.Running = false
   if type(self[""OnTick""]) == ""function"" then
   if self.Type == ""Interval"" and self.Running == true then

This should do the job. Btw. on the new compiler, this is copied by default in cartridges for Garmins and the Emulator.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...