syntax question

Nov 22, 2008 at 7:34am

syntax question

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!

Nov 22, 2008 at 7:49am

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.

Nov 22, 2008 at 11:52am

Another way…

– Pasted Max Patch, click to expand. –
Nov 22, 2008 at 8:36pm

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.


– Pasted Max Patch, click to expand. –

You must be logged in to reply to this topic.