Forums > MaxMSP

if $i1 < 0 then set 0

May 5, 2006 | 10:27 pm

if $i1 < 0 then set 0

whats wrong here? quick …


May 6, 2006 | 3:51 am

works here with

[number] -> [if $i1 < 0 then set 0] -> [print]

(numbers less than zero cause "set 0")

Roman Thilenius wrote:
> if $i1 < 0 then set 0
>
> whats wrong here? quick …


May 6, 2006 | 6:57 am

This might be obvious, but anyway: Remember that the "set 0" message
returned most likely will update value of the receiving object(s), e.g.
a number box, but they will not be outputting anything. If you want them
to output, don’t use the set:

#P button 235 208 15 0;
#P button 248 150 15 0;
#P window setfont "Sans Serif" 9.;
#P number 235 171 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 235 74 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 1;
#P newex 235 125 77 196617 if $i1<0 then 0;
#P button 107 208 15 0;
#P button 120 150 15 0;
#P number 107 171 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 107 74 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 107 125 94 196617 if $i1<0 then set 0;
#P connect 5 0 7 0;
#P connect 5 0 8 0;
#P connect 6 0 5 0;
#P connect 7 0 9 0;
#P connect 0 0 2 0;
#P connect 0 0 3 0;
#P connect 2 0 4 0;
#P connect 1 0 0 0;
#P window clipboard copycount 10;

Best,
Trond


May 6, 2006 | 1:56 pm

hi

put only 0!

if $i1 <0 then 0

if you need to update some other box use the object prepens: prepend SET.


May 6, 2006 | 3:29 pm

but it didnt "set" it, which is what i wanted it to do.

no idea what i had wrong yesterday, maybe my numbox
had a limit or maxmsp was making fun of me.

or it does not work on fridays … ?


May 6, 2006 | 4:31 pm

You don’t need the set.
if $i1 < 0 then O else out2 $i1
something like this migh be more interesting ?
Depends :-)


May 6, 2006 | 4:33 pm

hi

try this

max v2;
#N vpatcher 470 420 853 786;
#P button 204 203 15 0;
#P window setfont "Sans Serif" 9.;
#P number 202 107 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 203 175 35 9 0 0 1 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P button 14 245 15 0;
#P button 27 187 15 0;
#P number 14 208 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 14 111 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 1;
#P newex 14 162 103 9109513 if $i1<0 then 0 else $i1;
#P comment 22 71 47 9109513 try this;
#P window linecount 4;
#P comment 178 30 100 9109513 os set minimum 0 and the box don’t permit that you put a number < 0;
#P connect 3 0 2 0;
#P connect 2 0 4 0;
#P connect 4 0 6 0;
#P connect 2 0 5 0;
#P connect 8 0 7 0;
#P connect 7 0 9 0;
#P pop;


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