Button Counter starting at 100 with Reset?

How do we modify this button counter so it starts at a number other than Zero (say 100) and be able to reset it back to that number?
Button Counter.gh (3.6 KB)

Here’s the old thread

Hi @MJD ,

Not sure that I understand exactly what you are after?

Here are two options. I think the 2nd is what you want?

Reset will put the result back to 100 or whatever offset you specify, any button press will increment upwards of this value until reset.

Graph Space:

Does that solve it for you? If not, could you explain a bit more? Thanks

20240604_Button Counter_Response_01a.gh (7.4 KB)

1 Like

@michaelvollrath thank you, that works!

1 Like


counter with reset.gh (12.5 KB)

  private void RunScript(bool trigger, bool reset, double reset_value, double step_amount, ref object R)
  {
    if(v == Double.PositiveInfinity)v = reset_value;
    if(trigger) v += step_amount;
    if(reset) v = reset_value;
    R = v;
  }
  // <Custom additional code> 
  double v = Double.PositiveInfinity;

PS unistall bifocals and install Sunglasses plugin