Forums > MaxMSP

why is counter doing this?

August 20, 2008 | 1:47 pm

Hi,

I am using [counter] in updown mode counting from 0 to 10. I send the message "set 1," then start sending bangs.

Expected behavior: counter outputs 1 2 3… 9 10 9 8…
Actual behavior: counter outputs 1 0 1 2 3…

Why is it counting down rather than up and what is a simple way to remedy this?

Thanks in advance,
Jay

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 634 315 26 9109513 print;
#P button 634 237 15 0;
#P message 646 261 29 9109513 set 1;
#N counter 2 0 10;
#X flags 0 0;
#P newobj 634 291 68 9109513 counter 2 0 10;
#P connect 0 0 3 0;
#P connect 1 0 0 0;
#P connect 2 0 0 0;
#P window clipboard copycount 4;


August 20, 2008 | 1:57 pm


August 20, 2008 | 2:03 pm

> It’s quite logical, because it’s going down.

But this is the first message/bang counter receives. Updown mode begins counting upward; I don’t see why this should be any different.


August 20, 2008 | 2:14 pm


August 20, 2008 | 2:27 pm

> Expected behavior: counter outputs 1 2 3… 9 10 9 8…
> Actual behavior: counter outputs 1 0 1 2 3…

i don’t understand what do you want for behavior.
in updown mode the counter will print :

0 1 2 3 4 5 6 7 8 9 10 9 8 7 6 5 4 3 2 1 0

do you want no "zero" in the sequence ?


August 20, 2008 | 2:29 pm

or u might be able to roll your own modified counter using the [accum] object.

j


August 20, 2008 | 4:08 pm


August 20, 2008 | 4:32 pm

this might help you.

but i do not know why do you not need zero at start ?
anyway this is a demo of what [js] can do…

cheers


August 20, 2008 | 4:34 pm


August 23, 2008 | 7:50 pm

Why not just send it the message "set 0, set 1". That seems to set it in the upward direction. No need to use two counters.


Viewing 10 posts - 1 through 10 (of 10 total)