Creating an In-Game timer

Imagine you want to build an In-Game timer that saves the time a game has been played. For this you need to create a functionscript that continously counts. First you need to set some numbers in your startscript.

setnum (gamehours ; 0) setnum (gameminutes ; 0) setnum (gameseconds ; 0) setnum (frames ; 0)

Now you need to start a function with the command function (ingametimer ; infinit). This is the script for the timer :

setnum (frames ; +1) if_num (frames ; 50) { setnum (frames ; 0) setnum (gameseconds ; +1) } if_num (gameseconds ; 60) { setnum (gameseconds ; 0) setnum (gameminutes ; +1) } if_num (gameminutes ; 60) { setnum (gameminutes ; 0) setnum (gamehours ;+1) }

A looping script like a function usally loops 50 times a seconds. Everytime the number frames reaches 50 a second is added. When 60 seconds are reached a minute will be added and so on.