+Delta68 Posted January 21, 2015 Share Posted January 21, 2015 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. Thanks M Quote Link to comment
Ranger Fox Posted January 21, 2015 Share Posted January 21, 2015 I've seen this a few times before. To get around it, I used a countdown timer. If the timer should continue to run, I just start it again in my tick event. Not nice, but it gets the job done. Quote Link to comment
+jonny65 Posted January 21, 2015 Share Posted January 21, 2015 (edited) 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 January 21, 2015 by jonny65 Quote Link to comment
+charlenni Posted January 22, 2015 Share Posted January 22, 2015 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 end if type(self[""OnTick""]) == ""function"" then self[""OnTick""](self) end if self.Type == ""Interval"" and self.Running == true then self:begin() end end end This should do the job. Btw. on the new compiler, this is copied by default in cartridges for Garmins and the Emulator. Quote Link to comment
Recommended Posts
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.