Here's a timer I coded that tracks action keys being pressed. It tracks in seconds no matter how quickly the player presses and releases the action keys. Pretty accurate for anyone looking for a timer for their game.
Here's the code:
remstart
Game Timer
The timer basically keeps track of two different times
One tracks the time pressing an action key (upkey in this case)
The other tracks the time while no keys are being pressed
In order to keep track of action time, both action and nonaction times must be tracked
remend
randomize (timer())
sync on
rem create random number between 9 and 15
random_number = rnd(6)
random_number = random_number + 8
rem - set flags for nonaction and first time to press upkey
stop_flag=1
firstmove=0:rem Set the first time upkey is pressed
do
cls
print "Random Number ";random_number
print "Total Seconds the player is pressing up key: ";(seconds/1000)
print "Seconds player is not pressing up key: ";(time_minus/1000)
if upkey()1 and first_move=1 then gosub keep_minus_time:
if upkey()=1 then gosub time_keeper:
if (seconds/1000) > random_number then print "Player attack now ":end
sync
loop
time_keeper:
inc time_flag:if time_flag