Forums > MaxMSP

syntax question

November 22, 2008 | 7:34 am

I took a break from max/msp for quite a while and was doing more traditional coding. Now I am back and bashing my head against the wall trying to do something that is so simple in C but can’t figure out how to do in max:

What is the equivalent to having a variable that gets reset to zero every time after it has been read?

I want to have three random number generators that are triggered by three different keyboard keys. If any one of these keys is pressed, I want three values to be sent (the other two should be a value of zero) at the same time. If two keys are pressed then there should be two random values and one value of zero.

I bet there is a really simple way to do this and I am doing something the long way!


November 22, 2008 | 7:49 am

I think I figured it out.

I just use a Pak object and then have it reset itself to 0. 0. 0. using the set message triggered by every new output.


November 22, 2008 | 11:52 am

Another way…

– Pasted Max Patch, click to expand. –

November 22, 2008 | 8:36 pm

I agree, [pak] and the "set 0 0 0" message are the way to go here. Here’s a method that lets you set the random range and offset for each individual channel as well.

lh

– Pasted Max Patch, click to expand. –

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