Forums > MaxMSP

storing number for line~

June 11, 2008 | 6:09 pm

what is the best way of storing and changing sets of numbers to be used with line~. the sets of numbers will be of various lengths.

im a bit stuck due to the comma (eg 100, 69 68 47 36) which makes storing the numbers in a text box impossible as it reads the numbers as two separate lines of data…. whats the best object/way of storing them? pattr?

one idea i had was to store the numbers without the comma and then add it before it goes into line~ but i cant work out how to do that either.

Thanks Paul


June 11, 2008 | 7:11 pm

On Jun 11, 2008, at 11:09 AM, Paul de Casaparis wrote:

> im a bit stuck due to the comma (eg 100, 69 68 47 36) which makes
> storing the numbers in a text box impossible as it reads the numbers
> as two separate lines of data…. whats the best object/way of
> storing them? pattr?

A single number is really just shorthand for "go to this number
immediately."

You could just send pairs of number with the first being 0 0 (if you
wanted to start from 0)

-C

Chris Muir
cbm@well.com

http://www.xfade.com


June 11, 2008 | 8:04 pm

Hi Paul

You can use "coll" to store the lists without the comma and then slice them up with "zl slice" to make the "comma" effect.

look at this little example:

max v2;
#N vpatcher 315 205 915 605;
#P window setfont "Sans Serif" 9.;
#P newex 346 289 40 196617 print b;
#P newex 218 292 40 196617 print a;
#P window setfont "Sans Serif" 14.;
#P message 144 96 17 196622 2;
#P message 124 96 14 196622 1;
#P window setfont "Sans Serif" 9.;
#P hidden newex 23 22 48 196617 loadbang;
#P hidden message 10 81 61 196617 2 2 3 4 5 6;
#P hidden message 23 59 121 196617 1 12 13 14 15 16 17 18;
#N coll ;
#P newobj 124 132 53 196617 coll;
#P newex 281 280 32 196617 line~;
#P newex 305 246 51 196617 zl slice 1;
#P newex 264 140 27 196617 t b i;
#P message 328 73 61 196617 1 2 3 4 5 6;
#P message 328 49 112 196617 12 13 14 15 16 17 18;
#P newex 264 112 51 196617 zl slice 1;
#P user textedit 305 183 405 233 32896 3 9 3 4 5 6;
#P hidden fasten 10 0 9 0 28 48 15 48;
#P hidden connect 10 0 8 0;
#P hidden connect 8 0 7 0;
#P hidden connect 9 0 7 0;
#P connect 11 0 7 0;
#P connect 12 0 7 0;
#P connect 4 1 13 0;
#P connect 2 0 1 0;
#P connect 3 0 1 0;
#P fasten 7 0 1 0 129 156 234 156 234 99 269 99;
#P connect 1 0 4 0;
#P connect 4 1 6 0;
#P connect 5 1 6 0;
#P fasten 4 0 0 0 269 165;
#P connect 1 1 0 0;
#P connect 0 0 5 0;
#P connect 5 1 14 0;
#P pop;

- Morten


June 12, 2008 | 1:36 am

zl is a great object… thanks for introducing to to it.


June 12, 2008 | 10:51 am

WRT to commas in max u should read the tutorials and topics PDF (name might have changed in max 5). The chapter on punctuation (p.117) is the one you are after:

"As in an object box, the backslash () in a message negates the special characteristics of the character it immediately precedes."

other objects which can come in handy are: sprintf / atoi / itoa

hth,

j


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