Zero Problem… Can you solve it?

Mar 4, 2012 at 2:42pm

Zero Problem… Can you solve it?

Hi, I’m new to Max, so don’t be too harsh on me… so how can you say “all float numbers pass except for 0. (zero)” and “replace zero with X” in max language?
I have a float number box that determines the playback speed in a sfplay~ objet. I want it to be looped and never stop, so I can’t have 0. on that float number box… I tried a few ways to go around it but I wasn’t able to solve it. I’ll be glad if you can help me. Thanks.

#62142
Mar 4, 2012 at 3:30pm

[if $f1!=0. then $f1 else X]

#224462
Mar 4, 2012 at 4:19pm

Hello,

IMHO when you use FLOAT it’s often a better idea to not test strict equality but something like that instead (to avoid bad surprises with floating point artefacts) :

[if (abs(0. - $f1)) > 0.001 then $f1 else 100.]

#224463
Mar 4, 2012 at 5:38pm

Thanks!

@vanille béchamel: Hey your expression doesn’t work… it reports this error: “(…) has a comma or semi comma” … if I remove the semi comma it says: “bad gt string”…

#224464
Mar 4, 2012 at 5:43pm

Hello,

strange, it works fine on my computer (max 5.1.9) …

– Pasted Max Patch, click to expand. –
#224465
Mar 4, 2012 at 6:35pm

you can also use select object:

– Pasted Max Patch, click to expand. –
#224466

You must be logged in to reply to this topic.