Count all taps in every session

i can´t figure out how i can count and store all taps on a special button. 

I want to use the stored number for an archievment in the GPGS when it reaches maybe 100.000 clicks

hope someone can help me out.

Hi @tim.dean.official,

What kind of button are you using? A widget-based button? Just check each time that it’s tapped and add that value to a property of the button itself, very simple.

Brent

Hey Brent, 

no its not a widget based button. But i could use one if it is easier. Thats not the problem, but when i count the taps and want to save them into a external file, i have to read the old count and sum it with the new one. I can´t figure out how it works. I have no problem to read from a file and display ithe old taps But when i try to add the old with the new ones everytime the “.lua”  is shown i can´t get it to work. :confused:

I tried to bring it to work with a function with if else. If there is no file, create on and then write the taps in it. If there is one, read the old taps, save them. And then i can´t sum them and save them again. I get errors over errors :frowning:

Have you had a look at the tutorial about saving and loading scores - because it sounds as if your “taps” are “kind of like” a score.

So that may be of some help.

T.

Hi @tim.dean.official,

What kind of button are you using? A widget-based button? Just check each time that it’s tapped and add that value to a property of the button itself, very simple.

Brent

Hey Brent, 

no its not a widget based button. But i could use one if it is easier. Thats not the problem, but when i count the taps and want to save them into a external file, i have to read the old count and sum it with the new one. I can´t figure out how it works. I have no problem to read from a file and display ithe old taps But when i try to add the old with the new ones everytime the “.lua”  is shown i can´t get it to work. :confused:

I tried to bring it to work with a function with if else. If there is no file, create on and then write the taps in it. If there is one, read the old taps, save them. And then i can´t sum them and save them again. I get errors over errors :frowning:

Have you had a look at the tutorial about saving and loading scores - because it sounds as if your “taps” are “kind of like” a score.

So that may be of some help.

T.