Every 1 second,
add 1 to counter 2.
When counter 2 = 60,
set counter 2 to 0
add 1 to counter 1.
Milliseconds are going to be a problem, though. I think MMF can only go as low as 0.02 seconds, and not accurately.
Disclaimer: Any sarcasm in my posts will not be mentioned as that would ruin the purpose. It is assumed that the reader is intelligent enough to tell the difference between what is sarcasm and what is not.
I'm not really a fan of using the built in timer movement
What I'm using now is Always> add 1 to counter
I was told by someone that there is a way to use counters and have them work like timers based on division or something. I can't remember how that is done though.
It was something like 1/100 equals minutes 1/1000 equals hours, something like that don't quote me on it though
Anyone know what I'm talking about?
Also I supposed it doesn't really matter if the milliseconds aren't dead on, but why can't MMF count them accurately?
It's designed to stay in sync with actual time, not it's own internal loop. That's why you need to make your own loop, which you really should be doing anyway.
MMF runs by loops, it goes through the conditions then does it again, and then again. I think it's once per .02 seconds or something. So if you added 1 to a counter every loop, it would be a funky number depending on the speed. (FPS, more or less)
If you use Always, that's what it will do. The timer is separate from the loops... I think.
Originally Posted by DudeHuge I was told by someone that there is a way to use counters and have them work like timers based on division or something. I can't remember how that is done though.
It was something like 1/100 equals minutes 1/1000 equals hours, something like that don't quote me on it though
Anyone know what I'm talking about?
If you have a counter that counts the milliseconds then:
milliseconds=counter mod 1000
seconds=(counter/1000) mod 60
minutes=(counter/60000) mod 60
hours=(counter/3600000) mod 24 (you don't need the mod 24, if you're not counting days)
etc.
For the seconds and higher, don't you also need to substract the lower value before you divide?
That or you put the formulas between int() to get rid of the decimals.
By default, MMF works in integers. So there's no need for placing int().
I'm not sure what you mean by "lower value" though.
Edit: I took a look at your example, and I see what you mean with "lower value" now. The answer is no, I do a different calculation than what you do. I calculate the total amount of seconds (by dividing the total milliseconds by 1000) and then remove the counts higher than 60 by taking mod 60.
What you do is different (it's all correct though, but seems much more complicated to me), you actually first get rid of all the minutes by taking mod 60000, then you get rid of the milliseconds by subtracting the mod 1000 and then finally divide by 1000 to convert the milliseconds to seconds. (actually you were working in centiseconds, but that all works the same)
You follow me?
Edit again: Sקɪтzпαɢʟ, I just realised that you are making things too hard for yourself Like I said, you actually subtract the milliseconds, but you don't need to do that! Dividing by 1000 is enough, because as I said earlier MMF works in integers by default. You don't need to get rid of the "lower value" at all! So if you remove the "-Global Value A mod 6000" part everywhere, you'll see that your timer will still work
Yeah, it's designed to run at the frame rate. One loop is run every 1/FrameRate seconds. So, if you have 50 FPS (default), it's 0.02 seconds per loop. You can't count faster than that without some sort of extension for it. And if your FPS drops, the built-in timer might skip over the 0.02 second count.
So, you can't count in milliseconds. You should be using a 'timer counter' like that for all your timer events anyway. I was thinking of writing an article about that some time but never got to it
Disclaimer: Any sarcasm in my posts will not be mentioned as that would ruin the purpose. It is assumed that the reader is intelligent enough to tell the difference between what is sarcasm and what is not.