Backwards/Forwards step Counter?

Kristien Vanitas's icon

So i'm looking to make a step counter that can be toggled to move back and forth by one step via left and right arrow key inputs respectively. I already have two counters set up that allow it to move backwards by one, but I can't figure out how to get the counter to proceed forward by one correctly (a clearer example, if the counter is at 15, it can go backwards to 14, but skips directly over to 16 instead of going back over 15).
For context, I'm attempting to make a visual progression of images and text but would like for the user to be able to go backwards through the "slides" if needed.
If anyone has any solutions for a fix to this problem, it would be greatly appreciated.

Michel's icon

I am not sure I understand your problem. May be this patch is a solution.

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

Roman Thilenius's icon


dont use the counter object for that.

- make "up" an 1 and "down" a -1
- send them into [accum]
- add the result to the status quo of the destination.

Roman Thilenius's icon

save this to disk as [110.incdec]

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 345 196 23 196617 0;
#P newex 134 196 23 196617 0;
#P newex 368 83 108 196617 t b b;
#P newex 157 83 108 196617 t b b;
#P newex 881 283 146 196617 if $f1!=0 then $f1 else 1.;
#P newex 718 203 146 196617 if $f1!=0 then $f1 else 40.;
#P newex 553 125 146 196617 if $f1!=0 then $f1 else 300.;
#P newex 345 245 54 196617 defer;
#P newex 134 245 54 196617 defer;
#P newex 317 203 23 196617 1;
#P newex 106 203 23 196617 1;
#P newex 966 78 60 196617 loadbang;
#P newex 106 173 61 196617 gate;
#P newex 881 96 60 196617 f $3;
#B color 12;
#P newex 718 96 60 196617 f $2;
#B color 6;
#P newex 553 96 60 196617 f $1;
#B color 15;
#P newex 317 173 61 196617 gate;
#P newex 345 56 57 196617 route 0 1;
#P newex 345 221 54 196617 metro 40;
#P newex 368 143 56 196617 delay 300;
#N comlet Stepsize (default 0.01);
#P inlet 881 40 15 0;
#N comlet speed i f (default 40);
#P inlet 718 40 15 0;
#N comlet predelay i f (default 300);
#P inlet 553 40 15 0;
#P newex 466 301 42 196617 - 1.;
#P newex 466 263 42 196617 f;
#N comlet substract from control (button 1 0);
#P inlet 317 40 15 0;
#P newex 134 56 57 196617 select 0 1;
#P newex 255 301 42 196617 + 1.;
#P newex 134 221 54 196617 metro 40;
#P newex 157 143 56 196617 delay 300;
#P newex 255 263 42 196617 f;
#N comlet from control;
#P inlet 22 247 15 0;
#N comlet to control;
#P outlet 22 319 15 0;
#N comlet add to control (button 1 0);
#P inlet 106 40 15 0;
#P hidden newex 22 282 110 196617 bgcolor 150 250 50;
#P connect 21 0 30 0;
#P connect 14 0 21 0;
#P connect 23 0 19 0;
#P connect 23 0 20 0;
#P connect 23 0 21 0;
#P connect 20 0 29 0;
#P connect 13 0 20 0;
#P connect 19 0 28 0;
#P connect 12 0 19 0;
#P connect 30 0 7 1;
#P connect 30 0 11 1;
#P connect 3 0 4 1;
#P connect 3 0 10 1;
#P connect 10 0 11 0;
#P connect 32 1 10 0;
#P connect 27 0 10 0;
#P connect 28 0 5 1;
#P connect 28 0 15 1;
#P connect 29 0 6 1;
#P connect 29 0 16 1;
#P connect 15 0 18 1;
#P connect 32 0 15 0;
#P connect 17 1 32 0;
#P connect 16 0 27 0;
#P connect 25 0 16 0;
#P connect 34 0 16 0;
#P connect 17 0 34 0;
#P connect 9 0 18 0;
#P connect 9 0 17 0;
#P connect 18 0 25 0;
#P connect 4 0 7 0;
#P connect 31 1 4 0;
#P connect 26 0 4 0;
#P connect 5 0 22 1;
#P connect 31 0 5 0;
#P connect 8 1 31 0;
#P connect 6 0 26 0;
#P connect 24 0 6 0;
#P connect 33 0 6 0;
#P connect 8 0 33 0;
#P connect 1 0 22 0;
#P connect 1 0 8 0;
#P connect 22 0 24 0;
#P connect 11 0 2 0;
#P connect 7 0 2 0;
#P window clipboard copycount 35;

Roman Thilenius's icon


#P user pictctrl 164 381 21 21 purplebutton.pict 0 0 1 0 2 0 0 0 21 21 128 0 1 1 1 0;
#P user pictctrl 164 350 21 21 purplebutton.pict 0 0 1 0 2 0 0 0 21 21 128 0 1 1 1 0;
#P window setfont "Sans Serif" 36.;
#P number 41 355 106 36 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 245 478 188 9109513 110.incdec 300 50 1;
#P comment 304 349 100 9109513 regular use;
#P newex 275 150 37 9109513 t 1;
#P newex 247 114 37 9109513 t 1;
#P window setfont "Sans Serif" 36.;
#P number 32 77 106 36 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P button 147 105 37 0;
#P button 147 58 37 0;
#P window setfont "Sans Serif" 9.;
#P newex 236 200 188 9109513 110.incdec 0 0 1;
#P comment 289 62 100 9109513 your case;
#P connect 11 0 8 2;
#P connect 10 0 8 1;
#P connect 9 0 8 0;
#P connect 8 0 9 0;
#P connect 6 0 1 2;
#P connect 3 0 6 0;
#P connect 5 0 1 1;
#P connect 2 0 5 0;
#P connect 4 0 1 0;
#P connect 1 0 4 0;
#P window clipboard copycount 12;

Source Audio's icon

It would be more helpful to provide patch which is not working.
That would be more educative, cause one would be pointed to mistakes,
and not only getting ready solutions.
Now to the thema - there is nothing wrong about using counter,
only in case one wold not want to restart after hitting max count.
And if more then just 5 objects would be used to make it
increase or dicrease with keystrokes, than I would add scrolling....

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