1+1 = 1?

josha's icon

Hi,

Max Patch
Copy patch and select New From Clipboard in Max.

The attached patch counts space bar presses. However, it takes two presses to make the counter reach 1! I cant figure out what I've done wrong. any help please!?!

LSka's icon
Max Patch
Copy patch and select New From Clipboard in Max.

Counter starts counting from 0 by default. You can change the minimum number using the "setmin" message

josha's icon
Max Patch
Copy patch and select New From Clipboard in Max.

Thanks, but still not working. I have put setmin in teh patch and it still takes 2 key presses to make it register 1.....

brendan mccloskey's icon
Max Patch
Copy patch and select New From Clipboard in Max.

Hi
not sure why that happens, but whenever I want to initalize a [counter] I always set it to my minimum via the 4th inlet:

Brendan

Wetterberg's icon

yeah, "setmin $1" looks broken, at least on 6.1.2

I hardly ever initialize counters - if I want to count from 1 and upwards I typically do [+ 1] after the counter.

Christopher Dobrian's icon

Try: [counter 1 0x7FFFFFFF]

Chris Muir's icon
Max Patch
Copy patch and select New From Clipboard in Max.

I tend to use the sync reset for this sort of thing:

(and I'm sorry that there are so many quirks in counter. It was my first external, and my first C code)

Christopher Dobrian's icon

>> I tend to use the sync reset for this sort of thing

Yes, so do I.

Stephane Morisse's icon

Wetterberg, it was here prior to 6.12. I got mad with this in one on my patches, trying to figure out where my mistake was...
Chris : any chance you rewrite it ?
None of these three solutions works at first try : it only works once you have reset the counter for the first time. That means you have to launch it then reset it to get the desired behavior...

Chris Muir's icon

The maintenance of counter has been out of my hands since the 1990s.

I don't see what the problem with initializing to a desired state with something like loadbang / loadmess is, and doesn't Christopher's [counter 1 0x7FFFFFFF] do it without any further initialization?

This sort of initialization is just part of the process, IMO.

brendan mccloskey's icon

And "reset to number immediately" seems pretty self-explanatory to me.

Stephane Morisse's icon
Max Patch
Copy patch and select New From Clipboard in Max.

Ok, this works for me like this :

I wrote the previous post because it happened to me to get mad after trying all the solutions you proposed.