If you want a counter that only resets under some conditions, you need to use a variable for your counter. I've explained how the idle time works and what you want it to do isn't possible