why is counter doing this?

Aug 20, 2008 at 1:47pm

why is counter doing this?

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;

#39357
Aug 20, 2008 at 1:57pm

#138383
Aug 20, 2008 at 2:03pm

> 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.

#138384
Aug 20, 2008 at 2:14pm

#138385
Aug 20, 2008 at 2:27pm

> 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 ?

#138386
Aug 20, 2008 at 2:29pm

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

j

#138387
Aug 20, 2008 at 4:08pm

#138388
Aug 20, 2008 at 4:32pm

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

#138389
Aug 20, 2008 at 4:34pm

#138390
Aug 23, 2008 at 7:50pm

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.

#138391

You must be logged in to reply to this topic.