Forums > MaxMSP

question about [if]


FP
October 12, 2008 | 4:40 pm

hi,

is it possible to use only one if … then for this ?
and how can i get more information about [if] object ?

thx.

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P message 405 136 20 196617 10;
#P number 211 97 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 211 252 18 196617 t i;
#P newex 312 229 103 196617 if $i1 >= $i2 then -1;
#P newex 211 273 32 196617 print;
#P objectname u327000137;
#P newex 211 229 98 196617 if $i1 < = $i2 then 1;
#P comment 440 157 29 196617 max;
#P number 405 156 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P comment 334 157 29 196617 min;
#P number 299 156 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P connect 9 0 2 0;
#P connect 8 0 4 0;
#P connect 8 0 6 0;
#P connect 0 0 4 1;
#P connect 2 0 6 1;
#P fasten 6 0 7 0 317 249 216 249;
#P connect 4 0 7 0;
#P connect 7 0 5 0;
#P window clipboard copycount 10;


October 12, 2008 | 5:07 pm

Hi.
As you can’t use multiple/nested "if" (as "elseif") with [if] object, I
use workarounds based on [expr] for this kind of stuff.
It might give you some ideas…

Ciao

max v2;
#N vpatcher 25 69 665 575;
#P window setfont MPW 9;
#P number 227 284 50 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 227 256 209 196617 expr ($i1< =$i2)*1 + ($i1>=$i3)*-1;
#P message 417 149 21 196617 10;
#P number 227 169 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P comment 452 170 29 196617 max;
#B color 0;
#P number 417 169 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P comment 357 169 29 196617 min;
#B color 0;
#P number 322 168 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P connect 6 0 7 0;
#P connect 4 0 6 0;
#P connect 0 0 6 1;
#P connect 2 0 6 2;
#P connect 5 0 2 0;
#P pop;



FP
October 12, 2008 | 5:41 pm

great.
i’ll think about…
thx.

> I use workarounds based on [expr] for this kind of stuff


October 13, 2008 | 10:01 pm

[split] is your friend.



FP
October 14, 2008 | 1:19 pm

obviously !
thx.
>
> [split] is your friend.
> –
> —-
> Peter Castine
>


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