counter stuff

Apr 9, 2006 at 9:27pm

counter stuff

hi,

I wonder if anyone has a better handle on the logic of this…
I’m trying to feed a counter a random number which it will count up to and then send a bang when it reaches the maximum to trigger a new random number. However, if the new random number is higher than the old one, rather than starting the counter from the minimum count number, it just counts up from the previous value. if i make the bang trigger a number to reset the counter, then it displays this number instead of the max count number. um, hope this isn’t too convoluted an explanation of my problem.

thanks

#25319
Apr 10, 2006 at 12:07am

At 10:27 PM +0100 4/9/06, robin foster wrote:
>I’m trying to feed a counter a random number which it will count up to and then send a bang when it reaches the maximum to trigger a new random number.

Something like this?:
max v2;
#N vpatcher 318 48 546 323;
#P comment 91 216 33 196617 Count;
#P newex 66 186 35 196617 select;
#P newex 55 232 58 196617 print Count;
#P button 55 135 20 6;
#P newex 83 27 45 196617 loadbang;
#P number 55 215 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 83 135 38 196617 t 0 i;
#N counter;
#X flags 0 0;
#P newobj 55 158 66 196617 counter;
#P number 83 99 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P button 83 61 15 0;
#P newex 83 79 55 196617 random 10;
#P comment 99 61 84 196617 New random num;
#P comment 3 139 53 196617 Increment;
#P connect 9 0 5 0;
#P connect 5 0 7 0;
#P connect 7 0 10 0;
#P connect 5 0 11 0;
#P fasten 11 0 3 0 71 209 191 209 191 53 88 53;
#P connect 8 0 3 0;
#P connect 3 0 2 0;
#P connect 2 0 4 0;
#P connect 4 0 6 0;
#P connect 6 0 5 2;
#P fasten 4 0 11 1 88 126 140 126 140 180 96 180;
#P connect 6 1 5 4;
#P pop;

-C


Chris Muir | “There are many futures and only one status quo.
cbm@well.com | This is why conservatives mostly agree,
http://www.xfade.com | and radicals always argue.” – Brian Eno

#74434
Apr 10, 2006 at 9:21am

yeah, exactly like that acually. i think i get why that works – i was trying
to reset on next count rather than immediately. thanks a lot


robin

#74435

You must be logged in to reply to this topic.