If statement to run at exact time of timer property

Quick question for all you python people out there (or others), should be simple to answer:
How do you get an if statement to run only at a specific time on a timer property?

Here’s some sample code of what I’m doing


own["Ran2"] = random.randint(1, 9)
if own["Ran2"] == own["N Timer"]:
        own["prop"] += 1

due to floating point accuracy issues, this is not possible with a timer property. you need to convert the float to an integer, however, this could possibly cause the if statement to return true multiple times. counting by frame is preferable.

## "Timer" property is set to Type Integer ##

own["Timer"] += 1
rand = random.randint(1, 9)

if own["Timer"] == rand:
    own["prop"] += 1

how do you convert a number to an int in bge? int(some float)?

indeed

/10 chars

To properly avoid stepping problems, wait until the property is greater or equal to the value, rather than messing with rounding

I found the best way to do it was this


if timer >= time_desired:
    timer = 0.0