Message Boxes acting crazy

thesprucegoose's icon

Essentially, I'm randomizing a metro that fires out a value which runs through an if then state then bangs a message box accordingly. My issue is that the left most message box is constantly being banged (my guess is from the metro)

I've tried both [set x] in the left and [x] in the right, I've tried bangs instead of toggles, I've amended my if/then in every which way...

can someone offer advice or a suggestion why I'm continuing to work on this?

Thanks!

Max Patch
Copy patch and select New From Clipboard in Max.

samuelnichols's icon

Try using route 1 below each toggle. This will convert only the "1"s
coming out of toggle into bangs for the messages.

The problem is in hooking up the toggles to the message boxes. Right
now the toggle boxes are sending 1s and 0s to the message boxes. The
problem is that it's not just "1"s that trigger the message boxes:
"0"s also trigger them. (Shut off the metro, and click the toggle
above 3. It sets the lower message box to 3. Now click the toggle
above 4. A message of 4 gets sent. Then, deselect the toggle above
three, and watch as this 0 from toggle ALSO sets the lower message box
to 3.)

here's a quick fix--your patch + lots of routes

--Sam

Max Patch
Copy patch and select New From Clipboard in Max.

MIB's icon

route definitely works but why not send a bang from your if expression when the number matches, or even send the number directly...

here is a quick solution that might simplify your life a bit... I hope.

Max Patch
Copy patch and select New From Clipboard in Max.

Luke Hall's icon

If those are the actual ranges you're going to use then there is a much simpler way to go about getting the numbers you want. Here's an example. Obviously if those numbers were there just to demonstrate and you're going to use different size ranges this won't work so well.

lh

Max Patch
Copy patch and select New From Clipboard in Max.

LoneMonad aka don malone's icon
Max Patch
Copy patch and select New From Clipboard in Max.

Peter Castine's icon

Don's patch is a great improvement over the original, but the second random should be a [random 10].

Also the original post is apparently confused about how random works. A [random 100] objects produces values from 0 to 99 inclusive. The original patch never tests for zero (a possible output value) and tests for 100 (an impossible output value from a [random 100] object).

If you want values from 1 to 100 inclusive, then use a RNG object with sensible syntax, like [lp.tata 1 100].

You probably also want to prevent the [random 3000] object from sending zeros to your metro.

Max Patch
Copy patch and select New From Clipboard in Max.

BTW, using regexp is cute, but it would be much easier and more efficient to use some simple arithmetic, say [/ 10]. But unless you need the larger pseudo-random values, Don's approach is most straight forward.

Oh, right, [lp.tata] is from the Litter Starter Pack, see the link below. However, you currently need Litter Pro for Max 5.

Hope this helps,
P.