Just a basic timer that I made to count seconds, minutes and hours. Plan on using it in a game to time special states.
![](/gfx/set_like0.png)
![](/gfx/top_drop.png)
![](https://www.lexaloffle.com/bbs/files/15232/me-square.jpg)
I'm thinking this might not be very accurate when played Online as there is always some hiccup and stagger for some browsers.
Why not use TIME() instead ?
![](/gfx/set_like0.png)
![](/gfx/top_drop.png)
![](https://www.lexaloffle.com/bbs/files/12900/Screen Shot 2019-04-05 at 11.13.30 AM.png)
Because officially time() is "removed". Also because the number limit means you have to something along those lines anyway, so you might as well go all the way instead of relying on a function that may or may not return what you expect.
![](/gfx/set_like0.png)
![](/gfx/top_drop.png)
![](https://www.lexaloffle.com/bbs/files/15232/me-square.jpg)
Tyroney, you know for a fact I had no way of knowing this useful function wasn't "available."
Searching the HELP, I do see it was "removed" back in v0.1.1.
Curiously though it still works fine here.
If ZEP planned to remove it as you say - well, as we are on version 0.1.9b - I think he may have missed. :)
![](/gfx/set_like0.png)
![](/gfx/top_drop.png)
![](https://www.lexaloffle.com/bbs/files/12772/zphyTrqn.jpg)
This is useful, thanks. You may want to incorporate stat(1) to account for frame rate drops. Something like this:
local inc=flr(stat(1))+1 if timer1 < 30 then timer1 = timer1+inc |
When the frame rate is the normal 30fps (stat(1) < 1), then inc is 1. At 15fps, it's 2, at 10fps it's 3, etc.
![](/gfx/set_like0.png)
![](/gfx/top_drop.png)
![](/bimg/pi/pi24.png)
Thanks for the feedback and thanks for that tip musurca!
I did realize that if the FPS dropped, for whatever reason, then the timer would be effected. But I didn't know how to counter that. So I will incorporate that into the build.
![](/gfx/set_like0.png)
![](/gfx/top_drop.png)
![](https://www.lexaloffle.com/bbs/files/12900/Screen Shot 2019-04-05 at 11.13.30 AM.png)
To me the entire manual is kind of one big joke. Not that it's wrong or I don't respect it, but that its contents regularly make me laugh. (mostly at myself when I find/refind something that explains the hours of debugging I've been struggling with)
![](/gfx/set_like0.png)
![](/gfx/top_drop.png)
![](https://www.lexaloffle.com/bbs/files/15232/me-square.jpg)
Tyroney, why is TIMER not supposed to work - when it does ?
Why was it to be removed ? I've already written a bit of code with it, and it seems to be a pretty darned accurate timer with no problems.
![](/gfx/set_like0.png)
![](/gfx/top_drop.png)
![](/bimg/pi/pi24.png)
I was under the impression, looking at the wiki, that time() was initiated from cart boot?
Anyway the point of this system is that it is self contained. And cal be used in any situation.
[Please log in to post a comment]