Forums > MaxMSP

Help with number boxes

February 2, 2006 | 9:58 pm

Hi, quite a simple question I think! I have two number boxes which have constantly changing variables. But number boxes output a bang when they change, which is the problem as I want to add these two numbers together ONLY when a seperate bang is sent!

So there are 3 inputs a bang which activates the addition, and two variables which are added together. Any ideas from anybody?
Cheers
Dan Duke


February 2, 2006 | 10:12 pm

connect the number boxes to left inlets of int/float objects. outputs of these then go into the + object. when you need to calculate, send a bang to left inlets of int/float objects. mind the right to left order!


February 2, 2006 | 10:15 pm

The problem is when the numbers change as they re variables, these will then also send a bang through to complete the calculation, which is what I don’t want it to do!

Basically theres two boxes I can drag up and down with a number in, and at certain points I want to add them together, but only when I send a bang, not the int/float box sending one everytime it changes.


February 2, 2006 | 10:27 pm

thats what i said:

max v2;
#N vpatcher 15 55 615 455;
#P window setfont "Sans Serif" 9.;
#P number 56 309 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P button 13 170 15 0;
#P window linecount 1;
#P newex 13 200 19 9109513 t b;
#P newex 56 280 55 9109513 +;
#P number 118 213 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 73 213 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 101 255 27 9109513 int;
#P newex 56 255 27 9109513 int;
#P connect 6 0 5 0;
#P fasten 5 0 0 0 18 237 61 237;
#P connect 0 0 4 0;
#P connect 4 0 7 0;
#P connect 2 0 0 1;
#P fasten 5 0 1 0 18 237 106 237;
#P connect 1 0 4 1;
#P connect 3 0 1 1;
#P pop;


February 2, 2006 | 10:42 pm

the inlets/outlets are labeled are labeled.

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#N vpatcher 20 74 620 474;
#P button 51 50 15 0;
#P window setfont "Sans Serif" 9.;
#P newex 50 121 27 196617 + 0.;
#P newex 51 97 51 196617 zl slice 1;
#P newex 51 74 66 196617 pack 0. 0. 0.;
#N comlet addme2;
#P inlet 107 54 15 0;
#N comlet addme1;
#P inlet 79 54 15 0;
#N comlet bang;
#P inlet 51 30 15 0;
#N comlet instantaneos sum;
#P outlet 50 143 15 0;
#P connect 5 1 6 0;
#P connect 6 0 0 0;
#P connect 1 0 7 0;
#P connect 7 0 4 0;
#P connect 4 0 5 0;
#P connect 2 0 4 1;
#P connect 3 0 4 2;
#P pop;
#P newobj 332 233 114 196617 p instantaneousaddition;
#P window clipboard copytext "p instantaneousaddition" #E;
#P window clipboard copycount 1;


February 2, 2006 | 10:48 pm

Im not sure what you mean, sorry! Here is an image of what I have as an example! The patcher at the top alters the numbers which then come down! And the bang is sent by the user to add the numbers together!

Picture is here:

http://www.retrobadger.net/temp/maxhelp01.gif


February 2, 2006 | 11:10 pm

this is the last time. save this text as a text file and open with max!

max v2;
#N vpatcher 20 74 620 474;
#P button 51 50 15 0;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 51 124 27 9109513 + 0.;
#P newex 51 97 51 9109513 zl slice 1;
#P newex 51 74 66 9109513 pack 0. 0. 0.;
#N comlet addme2;
#P inlet 107 54 15 0;
#N comlet addme1;
#P inlet 79 54 15 0;
#N comlet bang;
#P inlet 51 30 15 0;
#P connect 0 0 6 0;
#P connect 6 0 3 0;
#P connect 3 0 4 0;
#P connect 4 1 5 0;
#P connect 1 0 3 1;
#P connect 2 0 3 2;
#P pop;


February 2, 2006 | 11:11 pm

Dan Duke wrote:
> Im not sure what you mean, sorry! Here is an image of what I have as
> an example! The patcher at the top alters the numbers which then
> come down! And the bang is sent by the user to add the numbers
> together!

Here’s a clip-patch which implements the first solution posted (with the
correction of using the right inlet of the [int] objects, which I think
the poster intended). I deleted the mail already so I’m neglecting the
credit, sorry. I think this is the simplest way.

#P window setfont "Sans Serif" 9.;
#P number 85 277 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 1;
#P newex 85 243 27 9109513 +;
#P button 36 107 60 0;
#P newex 126 199 27 9109513 i;
#P newex 85 199 27 9109513 i;
#P number 143 107 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 102 107 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P connect 5 0 6 0;
#P connect 2 0 5 0;
#P connect 3 0 5 1;
#P connect 4 0 2 0;
#P connect 4 0 3 0;
#P connect 1 0 3 1;
#P connect 0 0 2 1;
#P window clipboard copycount 7;


February 2, 2006 | 11:32 pm

I kinda get you know, but am new to the forums, and not sure how to open the text files into max! I have it on my desktop and opened it into max, but it’s still just a string of text!

Cheers for your patience


February 2, 2006 | 11:35 pm

I got it, cheers so much for your help, it is so much appreciated, sorry for being a bit too simple!
Dan


February 3, 2006 | 12:10 am

At 2:58 PM -0700 2/2/06, Dan Duke wrote:
>Hi, quite a simple question I think! I have two number boxes which have constantly changing variables. But number boxes output a bang when they change, which is the problem as I want to add these two numbers together ONLY when a seperate bang is sent!
>
>So there are 3 inputs a bang which activates the addition, and two variables which are added together. Any ideas from anybody?

use an int object between the left inlet of the + object and the number box. bang as needed.

Alternitively, you could add a "prepend set" object between the left input of the + object and the number box, then bang the left input of the + object when you want an addition.

-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


February 3, 2006 | 12:30 am

> sorry for being a bit too simple!
As long as you follow the ‘rules’ below you should never have to
hesitate to ask a question.

A: search the documentation
B: search the forums ( http://www.cycling74.com/forums/index.php?
t=search )
C: explain your problem as concisely as you can
D: are polite about your troubles.
E: worship the lord Zicarelli when the moon is in the eighth house of
Aquarius.


February 3, 2006 | 2:48 am


February 10, 2006 | 4:37 pm

matthew aidekman wrote:
> E: worship the lord Zicarelli when the moon is in the eighth house of
> Aquarius.

When is the next occasion? I need to ask some things to get my bills
payed with a Maxpatch….

Stefan

[][] [][][] [][] [][][] [][] [][][] [][] [][][]
[][][][][][][][][][][][][][][][][][][][][][][][][][][][]

Stefan Tiedje
Klanggestalter
Electronic Composition
&
Improvisation

/~~~~~
\ /|() ()|
))))) )| | |( \
/// _/)/ )))))
___/ ///

————————-x—
–_____———–|———-
–(_|_ —-|—–|—–()—
– _|_)—-|—–()———-
———-()————x—-

14, Av. Pr. Franklin Roosevelt, 94320 Thiais, France
Phone at CCMIX +33-1-49 77 51 72


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