Page 1 of 1

Turn on a button for X seconds

Posted: 03 Nov 2017 16:30
by Westbam
I am have some effects, that really only need to last a few seconds. And I if I forget to turn it off, well, lemur can do that for me.

But I am not able to turn a button of after X amount of time.
I tried to make it with a canvas overlay, send to front, to catch the clicks.

I figured I made 2 expressions, one on "On cursor Down" to make X 0 or 1, and Catch the time on that press, and another on that is set 'On Expression x==1' to see when my delay time is passed.

So far I have no success, really hope someone has a golden tip for me.

Re: Turn on a button for X seconds

Posted: 06 Nov 2017 08:53
by MrCorba
To get a button to react after x seconds, you need a few things:

- An expression that is set to the current time, when the button is pressed => timePressed = currenttime
- An expression that calculates the delay => delayPassedcurrenttime - timePressed > delayTime
- An script that listens to that expression and react if it evaluates true => delayPassed == 1

I've attached an example. It has a lot of extra objects to show the above logic.

Re: Turn on a button for X seconds

Posted: 07 Nov 2017 01:49
by Westbam
Wow, I think I understand it, and learned some new tricks about the scripting.
So the expressions keep on monitoring the values, regardless if you do anything with the button.

Thank you soo much, spend too much time in trying to solve this one.

Re: Turn on a button for X seconds

Posted: 11 Nov 2017 02:56
by Macciza
It is also possible to use a Pad and adjust the behaviour parameters and message timing to achieve a delayed turn-off
It can also be used as a ramp up/down if controlling send/return volume rather then just being on-off..
cheers