Here's a neat little trick to get timers to count upwards from zero instead of down to zero:
SetTimerRate("timername", -1)
I don't know if you will be able to start it if the timer is currently set to exactly zero, but I can confirm it works if you start it at 1 second, and I presume it would work if you started it to some small nonzero fraction, like
SetTimerValue("timername", 0.01)
I don't know if this is news to people, but I haven't found any posts about it, and I imagine it can be useful for survival/wave game modes and race modes.
Counting up on a timer
Moderator: Moderators
-
razac920
- 2nd Lieutenant

- Posts: 365
- Joined: Sun Jan 16, 2011 12:42 am
-
Noobasaurus
- Droid Pilot Assassin

- Posts: 2006
- Joined: Tue Aug 17, 2010 5:56 pm
Re: Counting up on a timer
Neato. I was going to something similar soon in a map of mine by having one timer count down from 1, and each time it hits one it would set the visual timer to one more second that it was. This will be quite useful. Wonderful find, as usual!
-
razac920
- 2nd Lieutenant

- Posts: 365
- Joined: Sun Jan 16, 2011 12:42 am
Re: Counting up on a timer
Yeah that was my original thought too, but this is much more efficient 
-
jedimoose32
- Field Commander

- Posts: 938
- Joined: Thu Jan 24, 2008 12:41 am
- Projects :: Engineering Degree
- Location: The Flatlands of Canada
Re: Counting up on a timer
Good find - I could have sworn I read something about this in the documentation, but I could be crazy. Either way thanks for bringing it out in the open. Could be used for some kind of survival challenge game mode - the player's score is proportional to the value of an upwards-counting timer.
-
Marth8880
- Resistance Leader
- Posts: 5042
- Joined: Tue Feb 09, 2010 8:43 pm
- Projects :: DI2 + Psychosis
- xbox live or psn: Marth8880
- Location: Edinburgh, UK
- Contact:
Re: Counting up on a timer
Neat find! 
Could we get this nifty little find on the FAQ?
Could we get this nifty little find on the FAQ?
