Forums > MaxMSP

continuous subtraction

December 16, 2007 | 3:06 pm

Probabbly a rtfm-question but i don’t know. I have a number box with a value. From that value I want to subtract every 1000 milliseconds 1.
so you go from 10 9 8 7 … until 1
The metro sends a bang avery 1000 ms and triggers the calculation but only one calculation is done,everytime 10- 1 = 9
So i connect the result number box to the first number box (where 10) but then i get a stack overload, how do I make the function work.
Thanks


December 16, 2007 | 3:15 pm

please post the problem part of the patch


December 16, 2007 | 3:24 pm

here you go: I am pretty sure it is a stupid mistake i make but I don’t know which one :s

max v2;
#N vpatcher 20 74 620 474;
#P toggle 4 33 15 0;
#P window setfont "Andale Mono" 9.;
#P newex 4 55 60 465436681 metro 1000;
#P button 48 80 15 0;
#P number 65 80 35 9 0 0 0 7102 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 65 165 27 465436681 – 1;
#P number 65 218 35 9 1 0 1 7102 0 0 0 221 221 221 222 222 222 0 0 0;
#P connect 5 0 4 0;
#P connect 4 0 3 0;
#P fasten 0 0 2 0 70 256 214 256 214 42 70 42;
#P connect 2 0 1 0;
#P connect 3 0 1 0;
#P connect 1 0 0 0;
#P pop;


December 16, 2007 | 3:27 pm

Hi,
Try something like this:

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P message 54 132 20 196617 11;
#P number 93 255 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 93 170 27 196617 10;
#P newex 93 200 27 196617 – 1;
#P toggle 93 101 15 0;
#P newex 93 127 64 196617 metro 1000;
#P connect 5 0 3 0;
#P connect 2 0 4 0;
#P fasten 2 0 3 1 98 230 151 230 151 162 115 162;
#P connect 3 0 2 0;
#P connect 0 0 3 0;
#P connect 1 0 0 0;
#P window clipboard copycount 6;

On Dec 16, 2007 10:06 AM, Samuel Van Ransbeeck wrote:
>
> Probabbly a rtfm-question but i don’t know. I have a number box with a value. From that value I want to subtract every 1000 milliseconds 1.
> so you go from 10 9 8 7 … until 1
> The metro sends a bang avery 1000 ms and triggers the calculation but only one calculation is done,everytime 10- 1 = 9
> So i connect the result number box to the first number box (where 10) but then i get a stack overload, how do I make the function work.
> Thanks
>


December 16, 2007 | 3:28 pm

try this

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 125 186 27 196617 i 10;
#P toggle 64 93 15 0;
#P window setfont "Andale Mono" 9.;
#P newex 64 115 60 465436681 metro 1000;
#P button 108 140 15 0;
#P newex 125 225 27 465436681 – 1;
#P number 125 278 35 9 1 0 1 7102 0 0 0 221 221 221 222 222 222 0 0 0;
#P fasten 0 0 5 1 130 306 186 306 186 169 147 169;
#P connect 5 0 1 0;
#P connect 2 0 5 0;
#P connect 1 0 0 0;
#P connect 3 0 2 0;
#P connect 4 0 3 0;
#P window clipboard copycount 6;


December 16, 2007 | 3:32 pm

thanks, it works.


December 16, 2007 | 5:57 pm

At 8:24 AM -0700 12/16/07, Samuel Van Ransbeeck wrote:
>here you go: I am pretty sure it is a stupid mistake i make but I don’t know which one :s

The set message is your friend:

#P toggle 11 78 15 0;
#P window setfont "Andale Mono" 9.;
#P window linecount 1;
#P newex 11 100 60 465436681 metro 1000;
#P button 11 121 15 0;
#P newex 90 133 65 465436681 prepend set;
#P newex 90 162 27 465436681 – 1;
#P window setfont "Andale Mono" 12.;
#P number 90 188 35 12 1 0 1 7102 0 0 0 221 221 221 222 222 222 0 0 0;
#P fasten 0 0 2 0 95 219 166 219 166 119 95 119;
#P connect 2 0 1 0;
#P connect 1 0 0 0;
#P fasten 3 0 1 0 16 154 95 154;
#P connect 4 0 3 0;
#P connect 5 0 4 0;
#P window clipboard copycount 6;


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


December 16, 2007 | 8:42 pm

Also "int" is very handy in these situations if you want to put a number
somewhere but not send it til later.

On 16/12/2007, Chris Muir wrote:
>
> At 8:24 AM -0700 12/16/07, Samuel Van Ransbeeck wrote:
> >here you go: I am pretty sure it is a stupid mistake i make but I don’t
> know which one :s
>
> The set message is your friend:
>
> #P toggle 11 78 15 0;
> #P window setfont "Andale Mono" 9.;
> #P window linecount 1;
> #P newex 11 100 60 465436681 metro 1000;
> #P button 11 121 15 0;
> #P newex 90 133 65 465436681 prepend set;
> #P newex 90 162 27 465436681 – 1;
> #P window setfont "Andale Mono" 12.;
> #P number 90 188 35 12 1 0 1 7102 0 0 0 221 221 221 222 222 222 0 0 0;
> #P fasten 0 0 2 0 95 219 166 219 166 119 95 119;
> #P connect 2 0 1 0;
> #P connect 1 0 0 0;
> #P fasten 3 0 1 0 16 154 95 154;
> #P connect 4 0 3 0;
> #P connect 5 0 4 0;
> #P window clipboard copycount 6;
>
> –
> 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
>


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