3 Interacting Buttons Script. Help!

Discuss Lemur and share techniques.
Post Reply
ctconard
Newbie
Posts:3
Joined:20 Feb 2014 03:51
3 Interacting Buttons Script. Help!

Post by ctconard » 19 Jul 2014 04:22

Hi everyone,

I'm fairly new to Lemur, and I'm having trouble with a particular script. I want to have three buttons, and have each button output different midi note on/off messages based on the current status of the other two buttons.

So, in other words, when the #1 button is pressed, I want it to query the #2 button and the #3 button and output accordingly based on the status of buttons #2 and #3. So there would be 7 different possible midi notes sent, as there are 7 different possible combinations of off/on that the three buttons could be in at any given time. I also want the same thing to occur whenever a button is turned off as well.

I've successfully done this with two buttons, which I've attached below, but adding a third button seems to complicate things. I think if I could see the proper way to script "when I press button 1, if button 2 and 3 are off then output C1, but if button 2 is on but 3 is off then output D1 etc" then I could probably figure out the rest. I hope I'm explaining this sufficiently. I've searched and searched and my brain is numb. Any help would be much appreciated. Thanks so much!

-craig
Attachments
switcher attempt.jzml
(3.01KiB)Downloaded 53 times

Softcore
Regular
Posts:1639
Joined:04 Nov 2012 08:34

Re: 3 Interacting Buttons Script. Help!

Post by Softcore » 19 Jul 2014 19:38

In a fast thinking of it (there might be a more elegant script to pull it off)....

For button 1, if button 2 is off -> if button 3 is on do this, if button 3 is off do that

else (so that means if button 2 is on)

-> if button 3 is on do this, if button 3 is off do that


For example lets say for the button HH, noteOn()

Code: Select all

if	(Snr.x==0){
if (Cl.x==0){
noteout(0,12,127,1);
}
else noteout(0,14,0,1);
}

else 
{
	if (Cl.x==0){
noteout(0,12,127,1);
}
else noteout(0,14,0,1);
}

hereis my example above with a third button called CL at button HH noteOn() (didnt do the rest)
Attachments
switcher.jzml
(4.5KiB)Downloaded 57 times

ctconard
Newbie
Posts:3
Joined:20 Feb 2014 03:51

Re: 3 Interacting Buttons Script. Help!

Post by ctconard » 20 Jul 2014 19:23

That's a big help, thanks!

Post Reply