Forums > MaxMSP

How to: make a number box only display multiples of two

Apr 30 2012 | 8:46 pm

I have a number box with a range of 32. In presentation mode, I would like a user to be able to alter this number box by dragging the mouse, however, I only ever want the user to be able to select multiples of 2. i.e dragging the box down from 32 will display 30, 28 then 26 etc. Is there anything I can do to get around this?

Apr 30 2012 | 9:09 pm

Perhaps this is the most elegant way to achieve this.

-- Pasted Max Patch, click to expand. --

Apr 30 2012 | 9:11 pm

I hope this will help you :

-- Pasted Max Patch, click to expand. --

Apr 30 2012 | 9:14 pm

I meant "isn’t the most elegant way…"

Also, you’ll need the .txt file for coll.

  1. blergh.txt
Apr 30 2012 | 9:17 pm

put lcd in background or ubutton in foreground, and use those to get mousevalues.

scale mouse data to int, then *2

Apr 30 2012 | 9:22 pm

That is exactly what I am looking for Pierre G.

Apr 30 2012 | 11:20 pm

-- Pasted Max Patch, click to expand. --

May 01 2012 | 9:01 am

-- Pasted Max Patch, click to expand. --

May 01 2012 | 9:42 am

Broc I think you got the ‘most elegant way’…

May 01 2012 | 5:50 pm

Awesome! I really need to explore more of the live objects. I use live.gain almost exclusively now, but I haven’t really explored the others. Thanks for posting that!

May 01 2012 | 6:23 pm

Very cool that you can set the steps in live.numbox!

But…can Pierre or anyone else explain why his patch works the way it does? It’s confounding my brain…if the result of the "if" statement comes out, shouldn’t there be a stack overflow created?

May 01 2012 | 9:18 pm

Take a closer look at his patch, there is a hidden element that helps achieve this result :)


May 05 2012 | 9:19 pm

wow, I am an idiot :D

no wonder I couldn’t figure out how the number box was responding to clicks when "ignore click"… sheesh, it was the other one. DOH!

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

Forums > MaxMSP