remove a space before a coma in a message

Nov 1, 2008 at 11:17pm

remove a space before a coma in a message

Hello,
I need to store the initial value before getting the target and ramp time for a line object.
I’ve been searching and trying a few things but cant get any solution that doesn’t generate a space before the coma in a message.
Here are the two ways I’ve tried to get rid of it without success.

max v2;
#N vpatcher 314 301 1060 800;
#P window setfont “Sans Serif” 9.;
#P message 269 346 47 196617 23 , 456;
#P newex 510 159 49 196617 append 0;
#P newex 510 137 61 196617 gate 2;
#P newex 600 107 37 196617 zl len;
#P comment 216 74 249 196617 (it might works with a simple message too);
#P message 269 328 80 196617 150 , 32 10000;
#P message 269 310 80 196617 57 , 100 10000;
#P window setfont “Arial Bold” 20.;
#P flonum 219 424 108 20 0 0 0 -18240 0 0 0 221 221 221 222 222 222 0 0 0;
#P window setfont “Sans Serif” 9.;
#P newex 217 387 53 196617 line 0. 20;
#P message 443 197 22 196617 foo;
#P number 441 33 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 443 357 32 196617 print;
#P newex 474 268 62 196617 prepend set;
#P message 474 290 101 196617 foo 91 , 100 0;
#P newex 521 195 49 196617 unpack;
#P button 443 168 14 0;
#P newex 443 243 77 196617 substitute + \,;
#P newex 443 317 51 196617 route foo;
#P message 550 60 20 196617 29;
#P message 471 60 26 196617 100;
#P message 571 60 61 196617 100 10000;
#P message 499 60 49 196617 0 10000;
#P newex 443 220 127 196617 sprintf %s %ld + %ld %ld;
#P newex 139 356 32 196617 print;
#P message 117 66 20 196617 29;
#P message 39 66 26 196617 100;
#P message 139 66 61 196617 100 10000;
#P message 67 66 49 196617 0 10000;
#P number 206 35 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 160 248 62 196617 prepend set;
#P newex 139 275 45 196617 prepend;
#P button 160 177 15 0;
#P newex 160 223 70 196617 sprintf %ld +;
#P newex 139 316 77 196617 substitute + \,;
#P newex 160 200 27 196617 int;
#P comment 254 34 159 196617 initial value for line comes first;
#P comment 230 57 215 196617 then comes the list
;
#P window linecount 5;
#P comment 333 401 100 196617 the space before the coma makes line interpret the initial value as a target value;
#P window linecount 1;
#P comment 265 296 100 196617 this works of course;
#P fasten 14 0 8 0 122 253 144 253;
#P fasten 13 0 8 0 44 259 144 259;
#P connect 12 0 8 0;
#P fasten 11 0 8 0 72 256 144 256;
#P connect 9 0 8 0;
#P connect 8 0 5 0;
#P connect 5 0 15 0;
#P fasten 14 0 7 0 122 164 165 164;
#P fasten 13 0 7 0 44 170 165 170;
#P fasten 12 0 7 0 144 161 165 161;
#P fasten 11 0 7 0 72 167 165 167;
#P connect 7 0 4 0;
#P connect 4 0 6 0;
#P connect 6 0 9 0;
#P connect 10 0 4 1;
#P connect 38 0 30 0;
#P connect 33 0 30 0;
#P connect 32 0 30 0;
#P connect 21 0 30 0;
#P connect 5 0 30 0;
#P connect 30 0 31 0;
#P fasten 18 0 23 0 576 86 448 86;
#P fasten 20 0 23 0 555 86 448 86;
#P fasten 17 0 23 0 504 86 448 86;
#P fasten 19 0 23 0 476 86 448 86;
#P connect 23 0 29 0;
#P connect 29 0 16 0;
#P connect 16 0 22 0;
#P connect 22 0 21 0;
#P connect 21 0 27 0;
#P connect 22 0 26 0;
#P connect 26 0 25 0;
#P connect 28 0 16 1;
#P fasten 35 0 36 0 605 130 515 130;
#P connect 36 0 37 0;
#P connect 36 1 24 0;
#P connect 37 0 24 0;
#P connect 24 0 16 2;
#P connect 24 1 16 3;
#P connect 18 0 36 1;
#P connect 20 0 36 1;
#P connect 17 0 36 1;
#P connect 19 0 36 1;
#P connect 18 0 35 0;
#P connect 20 0 35 0;
#P connect 17 0 35 0;
#P connect 19 0 35 0;
#P pop;

thank’s for help

#40609
Nov 1, 2008 at 11:24pm

This message sent to a line object:

0, 100 1000

is exactly the same as sending a separate message of:

0

followed by a separate message of:

100 1000

The comma in “0, 100 1000″ only tells max to separate those two parts of the message into two different messages. So, instead of trying to get rid of the comma, just send the initial value to the line, and then send the ramp information to the line directly afterwards.

#143793
Nov 2, 2008 at 11:06am

Removing the space before the + character in your [sprintf] should work. However, if I’ve properly understood what you’re trying to do a much simpler method would be to use [sprintf %ld, %ld %ld] which will give you the messages formatted for the [line] object. The trick here is the slash which escapes the special meaning of a the next character.

lh

#143794
Nov 2, 2008 at 11:44am

Oh yes, of course, I was focusing on the loop problem that comes because the output of the line object drives the same object that might sends the new initial value.
a simple int is my solution
thanks for your help

max v2;
#N vpatcher 14 59 435 475;
#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P comment 82 95 115 196617 target and ramp_time;
#P number 234 60 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 206 262 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 95 342 79 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 121 278 53 196617 line 0. 20;
#P message 139 111 20 196617 29;
#P message 60 111 26 196617 100;
#P message 162 111 61 196617 100 10000;
#P message 88 111 49 196617 0 10000;
#P button 202 185 15 0;
#P newex 202 226 27 196617 int;
#P comment 271 61 65 196617 initial value;
#P connect 7 0 8 0;
#P connect 4 0 7 0;
#P connect 6 0 7 0;
#P connect 3 0 7 0;
#P connect 5 0 7 0;
#P connect 1 0 7 0;
#P fasten 4 0 2 0 167 148 207 148;
#P fasten 6 0 2 0 144 148 207 148;
#P fasten 3 0 2 0 93 148 207 148;
#P fasten 5 0 2 0 65 148 207 148;
#P fasten 2 0 1 0 207 212 207 212;
#P connect 1 0 9 0;
#P connect 10 0 1 1;
#P fasten 7 0 1 1 126 311 257 311 257 222 224 222;
#P pop;

#143795
Nov 4, 2008 at 1:56pm

FXRobert schrieb:
> Oh yes, of course, I was focusing on the loop problem that comes
> because the output of the line object drives the same object that
> might sends the new initial value. a simple int is my solution

Your solution works of course, but you could still benefit from learning
how to use the trigger object. In your case a [t l b]… It not only
helps to point to the correct order of execution, it also prevents
breaking your patch by moving around some of the objects…

Stefan


Stefan Tiedje————x——-
–_____———–|————–
–(_|_ —-|—–|—–()——-
– _|_)—-|—–()————–
———-()——–www.ccmix.com

#143796

You must be logged in to reply to this topic.