How can I make a button or pad do 2 functions?

Discuss Lemur and share techniques.
Post Reply
digitalson
Regular
Posts:143
Joined:21 Mar 2015 02:26
How can I make a button or pad do 2 functions?

Post by digitalson » 23 Jul 2015 18:00

Like alternate 1st press 1st command and 2nd press 2nd command? Not as a release,but 2 separate commands,,,,,thanks

digitalson
Regular
Posts:143
Joined:21 Mar 2015 02:26

Re: How can I make a button or pad do 2 functions?

Post by digitalson » 23 Jul 2015 18:52

Would making a button in switch mode then make a script on release for the 2nd command work?

digitalson
Regular
Posts:143
Joined:21 Mar 2015 02:26

Re: How can I make a button or pad do 2 functions?

Post by digitalson » 23 Jul 2015 18:53

Or maybe a hold function? How can I do that? Would that work?

digitalson
Regular
Posts:143
Joined:21 Mar 2015 02:26

Re: How can I make a button or pad do 2 functions?

Post by digitalson » 23 Jul 2015 18:55

But will a hold function still do the first command? If not that might be cool for some other buttons I have

ndivuyo
Regular
Posts:279
Joined:23 May 2014 00:24

Re: How can I make a button or pad do 2 functions?

Post by ndivuyo » 24 Jul 2015 23:07

You can do both ways, which do you want?

You could also do both of them in several different ways haha, it depends on what the function is maybe?

A switch is one way for the first method. You can either have 2 scripts on positive/null transitions or 1 script with conditions. Then for each section (pos to null/ null to pos) you will do the separate desired functions.

Or for the first method you could have a variable that increments (++) and %2 each time you press the pad (so script is executed only on null to positive transition). Then the 2 functions would trigger depending on the current value of said variable.


For your second option, the 'hold' option, you would need to make a variable and have it act as a timer. The easiest way to do that would be have a script running on frame, and if a certain condition is met the variable increments (++) until it reaches the desired value.
So, depending on what you want (for example):: when you press down the button initially the first function is triggered, and then when the variable hits the desired value, the 2nd function is triggered and the counting stops and variable is reset (do that with a condition).

That is one way you could do it. Personally I avoid on frame scripts now and use a "dummy" multislider with the physics function on and drop the value slowly from 1 to 0. Then I make scripts that trigger on it's expression 'x' as a replacement for "on frame"


Hope it helps, let me know.... There are many optionss

digitalson
Regular
Posts:143
Joined:21 Mar 2015 02:26

Re: How can I make a button or pad do 2 functions?

Post by digitalson » 25 Jul 2015 21:41

Well a hold will still do command 1? How bout alternating ? Like on then off?

ndivuyo
Regular
Posts:279
Joined:23 May 2014 00:24

Re: How can I make a button or pad do 2 functions?

Post by ndivuyo » 26 Jul 2015 22:06

Yes of course. You can do many variations of what you want. I think you should look up how to code conditions (if,then) and create and work with expressions. And how to work with basic scripts in lemur.
Check out the user manual, learn your operators and some commands, or at least know where to look for the list of them.
Shouldn't take much time to learn it, then you can easily create any number of methods to switch between and execute 2 or more functions in one pad/switch. Just my suggestion, since it seems like you often want to do scripting solutions.
Hope that helps

digitalson
Regular
Posts:143
Joined:21 Mar 2015 02:26

Re: How can I make a button or pad do 2 functions?

Post by digitalson » 26 Jul 2015 23:49

What it is that I don't really know the scripting stuff ,and don't have time to sit and mess with it to much,,I'm always working,,I find stuff from other projects and try to make them work with what I'm tring to do,,,and sometimes I come across some cool stuff by accident,,,,but I'm picking it up

ndivuyo
Regular
Posts:279
Joined:23 May 2014 00:24

Re: How can I make a button or pad do 2 functions?

Post by ndivuyo » 29 Jul 2015 04:23

hmm, it seems like you want to go a little more in depth though. I mean, depending on your speed you could learn it very fast. You will save a lot more time than in the end trying to frankenstein everything together, especially if you want to customize everything the way you want it. But of course most people do that a lot at first to learn and all, myself included, I don't think it's a bad thing in a program like lemur.

Whatever you want to do, it's none of my business, but I really think it will pay off will a little bit of investigation (ie just know how to do < 10 things)
Maybe take you no time!

So to help you, I made a pad object that has some expressions and scripts in there with tons of comments on everything. Read the script called READPLEASE(), and go from there. Hopefully it'll help you understand one way to do this whole thing, and with those few tools, you can do it many more ways.

Let me know if you have any questions
Attachments
ScriptingHoldTut.jzlib
(6.12KiB)Downloaded 213 times

Post Reply