Count the number of button clicks

Hi,

Small simpel question but I cant find out…
I would like to ‘count’ the number of clicks on a button. (1,2,3,4 etc…)

I came up with the items GH script below.
However, for some reason it adds 2 (instead of 1) for each click, so 2,4,6, etc.

Does anyone have a word around?

2020-09-15 Count the number of button clicks.gh (3.8 KB)

Thanks :slight_smile:

Hi,

Click it continuously it will come in 1,2,3, order.

Cheers,
BVR

Ahh thanks foy your quick answer.
You are right, unfortunately I would like to add only +1 for 1 single (not continuous click).

Any suggestions?

Thanks,

Clicking a button causes two events, OnMouseDown and OnMouseUp, which triggers twice whatever it’s connected to.

4 Likes

Even simpler:

button_clicks

3 Likes

T
hank you! Perfect :+1:

My method too

Please note that simplifying and reversing the input and having a meaningless expression (“x”) on the output of Lng (List Length) is all pointless.