Timer (mechanic)

Timers are used to measure game turns and are often used in level scripts to trigger events based on how much time has passed since another.
== Dungeon Keeper ==
Timers are set with the SET_TIMER script command, and run indefinitely, increasing by one each game turn. The SET_TIMER command can be called again to reset the timer, causing it to start over from zero. There are a total of 40 (64 in KeeperFX, due to the addition of three players) possible timers available in one script, eight for each player (numbered from 0 to 7, covering the four Keepers and the hero faction). Despite this, the 'owner' of the timer has no relevance to the timer's contents or function, and merely serves to distinguish different timers, meaning one can freely use timers labelled with non-existent players.
A timer's value can be checked with an IF command. They operate behind-the-scenes, so the player is never aware of a timer's status during a game.
Bonus levels display a timer that is discrete from (it only sets the display), but usually based on, the script timer used for the actual time limit: they usually have the same value to make it seem that there's a connexion between them. It is set with the BONUS_LEVEL_TIME command. In KeeperFX, it is possible to have this timer in non-bonus levels too.
KeeperFX versions 0.4.9 and later have an ADD_TO_TIMER script command to manipulate timers beyond simply (re)setting them: it can add or deduct (when it uses a negative value) time from a timer. The ADD_BONUS_TIME command does the same for the bonus timer.
== Dungeon Keeper 2 ==