Im working on a little project that uses drivers... I have used them extensively but Im failing to find a solution for this problem. In this project I wont use scripts. Also, this is not on BGE, but on the regular viewport.
Im trying to make a driver expression on an empty0 so that it's X location is added by 1 every time some other event happens. For example, if a cube location goes from 0 to 1, add+1 to empty0 once. But this must work on runtime, 24fps.
So this is the problem: driver expressions are little pieces of code that are run every frame change, therefore every time I do something like:
"add +1 to variable1 if some other variable2==1"
it doesn't do it only once, it will check 24 times a second if the variable2==1 and will add +1 to variable1 24 times in a second. I wanted it to only add +1 one single time every time the cube goes to x==1. If I move the cube back to zero, nothing should happen, If I move the cube back to 1 again, it should add+1 to empty0 xloc one more time only, until I repeat the process
If drivers had a "While loop" to check "while variable2==1" before making the addition to variable1, it would solve the problem. But I don't think there is, and I cannot think of another way of simulating a "while" using other drivers and tricks.
The core of the problem is the fact that a driver is being run 24 times a second and I wanted to add a simple +1 to x location of an object just once every time a cube location =1.
Maybe someone here has an idea of how to solve it...
Heres a blend file as example of the problem: