How reset the on/off state of a switch with another switch?

Discuss problems and solutions.
Post Reply
tater01
Newbie
Posts: 38
Joined: 24 Jan 2016 19:17

How reset the on/off state of a switch with another switch?

Post by tater01 »

Hello everyone!

I was wondering if anyone out there knows a way to reset, or change the on/off state of a switch with another switch. I have two examples.

Example 1:
Container Example.jzml
Example with switches controlling containers view
(13.42 KiB) Downloaded 87 times
This example I have some buttons controlling the view of some containers. My goal is to open one container and it makes the other containers disappear. I have that working. But, when you go to open that same container again you have to double push the button. Like when you open container A, then open container B, then go back to open container A again, you have to push A button twice. I was wondering if it is possible when you push button A to open container A, then push button B to open container B, it resets button A to off again?

Example 2:
Multiswitch Example.jzml
Multi Button Example
(9.33 KiB) Downloaded 80 times
This example I have two Multi Switches. What I want is only one switch to be on at all times whether you push a switch on either Multi Switch. So, if I push a switch on one Multi Switch, only that one switch is lit up/on for either switch. So it needs to clear the expression of the Multi Switch I touched leaving only the one switch lit up, and it needs to clear the other Multi Switch also.

Any help would be appreciated!
Thanks!
oldgearguy
Regular
Posts: 315
Joined: 02 Nov 2013 11:19

Re: How reset the on/off state of a switch with another swit

Post by oldgearguy »

there's a lot of stuff that can be adjusted here, but one easy trick is that instead of doing

show(A,0),

simply "press" the A button again:

AButton.x = 0 in the B and C button code.

There may also be a need to save the state of whatever you had open (IOW - if you had A1 and A2 open, then open B, all A's close. Next time you open A, you might want A1 and A2 to open automatically).
tater01
Newbie
Posts: 38
Joined: 24 Jan 2016 19:17

Re: How reset the on/off state of a switch with another swit

Post by tater01 »

Hey, thanks!
That works really great! That was exactly what I was looking for! Cool! I feel like a retard. That seems so simple I just couldn't figure out how to do it!

Questions though. Is there a way to do that to a button in another container? Like have button B turn off or press button A1. Even further than that. Is there a way to turn off or press a button in another interface?

And for the purpose for which I needed this just pressing the button works great. If you want to give an example of how to save the open state of the container and load it again like you said, I'm more than willing to learn but I don't need it for this example. Like if A1 container was showing, press button B and A1 container hides. But press button A again and A1 is still open. That would be cool to learn. That might actually wrap my head around saving one preset. Then one day I might be able to understand the preset and playback scheme from the stepsequencer!

Also, for the second example. The one with two separate multiple switches. I thought of a better way to explain it. I just want it to have only one of the multi switches on at all times. Only one switch on either one to be able to be lit up or on.

Thanks again for the help man. Your are awesome!
tater01
Newbie
Posts: 38
Joined: 24 Jan 2016 19:17

Re: How reset the on/off state of a switch with another swit

Post by tater01 »

Ok, thank you for not answering me and making me use my brain. Sorry for asking stupid questions that I already knew the answer to!

So I figured most of it out. I knew how to reference objects in other containers by using periods. Like Acontainer.A1container.button.x.
So I already knew that. Duh. But I guess I ran into a small kink. It won't let me reference a button four containers deep. So I was thinking I could make an invisible button two containers deep to control the button four containers deep. I guess that is a workaround. Unless you know an easier way?
So, unless their is an easier way to access a button four containers deep, then example one is solved!

So, example two. Again I was being stupid and lazy. The same button trick works on the multi switches! So thank you again for that.
So here is the multi switch example with the script added to cancel out the other switch:
Multiswitch Example 2.jzml
Better example
(9.76 KiB) Downloaded 96 times
Also, thank you for not making fun of me or calling me dumb. I figured out what the radio setting does! Yay! So, with radio on it cancels out buttons on itself so only one switch is on at a time! Yay! I like cake! So that is working! And I added the button press script to each one, that is working. Yay, thank you for that. But it has one small glitch. You have to double tap insertedit to get it to come on. One tap on insertedit shuts off insertedit2, and the second tap on insertedit then effectively turns on insertedit. Is there a way to fix that?

Thanks again for your help and not calling me dumb (haha) for not seeing the obvious!

NEVERMIND!!!!

Got it working! Had the values wrong!

Thanks once again oldgearguy!!!
Don't know what I'd do without ya!
oldgearguy
Regular
Posts: 315
Joined: 02 Nov 2013 11:19

Re: How reset the on/off state of a switch with another swit

Post by oldgearguy »

usually I don't answer because I'm not logged in or on a computer 24/7.
I check these Liine forums maybe once or twice a week, so if I catch a question and have time, I'll answer.

Most of my limited free time is spent off the computer.
tater01
Newbie
Posts: 38
Joined: 24 Jan 2016 19:17

Re: How reset the on/off state of a switch with another swit

Post by tater01 »

Sorry bud. Didn't mean it sarcastically like that at all. I meant it literally like I was happy you didn't answer because I discovered what I already knew. Self-discovery is much more gratifying than just having someone give it to you.
So really, I'm sorry if you took it like I was rushing you. Didn't mean it like that at all! I appreciate everything you've ever done for me greatly. My project would still be in the stone ages if it wasn't for you!
Can't say Thank You enough for that!

Also, whenever you have time... Is it possible to reset a fader to 0 with a button?
Zero out fader with button.jzml
Fader to 0 Example
(3.13 KiB) Downloaded 75 times
Just trying to get workflow a little better, not necessary.

Thanks again for all your great help. You are really a kind person to help out strangers!
oldgearguy
Regular
Posts: 315
Joined: 02 Nov 2013 11:19

Re: How reset the on/off state of a switch with another swit

Post by oldgearguy »

These are the kind of small, core functions that you should build up and have on disk for future reference. The idea of one object controlling another is central to solving some more difficult problems in Lemur. Remember, the objects don't just tell you about their current state/position with their variables, you can also use them to set the state/position.
Attachments
ZeroIt.jzml
(3.32 KiB) Downloaded 94 times
oldgearguy
Regular
Posts: 315
Joined: 02 Nov 2013 11:19

Re: How reset the on/off state of a switch with another swit

Post by oldgearguy »

tater01 wrote:Sorry bud. Didn't mean it sarcastically like that at all. I meant it literally like I was happy you didn't answer because I discovered what I already knew. Self-discovery is much more gratifying than just having someone give it to you.
So really, I'm sorry if you took it like I was rushing you. Didn't mean it like that at all! I appreciate everything you've ever done for me greatly. My project would still be in the stone ages if it wasn't for you!

Just trying to get workflow a little better, not necessary.

Thanks again for all your great help. You are really a kind person to help out strangers!
no problem - I read that quickly and missed the intent.

By the way, in the multiswitch example (and maybe others) you might want to experiment with the trigger condition for the script (i.e. on expression - x - any; the 'any' part).
Depending on how you click and move when clicking, you can sometimes get all buttons off using 'any'. Often, I'll find that using the low-to-high indicator (arrow pointing up) works better for these types of things.

in the case of a button, off = 0, on = 1. If the button is off and your finger touches it, x changes from 0 to 1 on the touch. Again, if it's a button, it will change from 1 to 0 when you touch it again. If it's a pad, it goes from 0 to 1 on touch and 1 to 0 when you release it. So doing an action in the script (or multiple actions) can be controlled by only doing it on the transition. Any means any time the state (in this case x) changes, execute the script, which may not always be what you want. Sometimes I'll use any when I want to do 2 different things depending on whether the button is turning on or off. In that case, I have to check to see if x == 1 or x == 0 and do things differently depending on that check.
Post Reply