Page 1 of 1

Hi, new here. Building my first project at the moment.

Posted: 18 Mar 2015 20:34
by slingdinger
Been learning how to use Lemur for a couple of days now. My first project is a controller for the Pigtronix Inifinity Looper midi input. Working well so far, but I could definitely use some help with scripting.

I've added a pad button to a fader acting as a momentary on/off switch. Right now I have two scripts running in that pad, one where x=0 executeas leaving zero, and one where x=0.5 executes reaching zero. That works well as a momentary on/off switch, but it always returns to a fixed value. Can I set it so the fader returns to the original value set before I've engaged the pad?

Re: Hi, new here. Building my first project at the moment.

Posted: 18 Mar 2015 22:48
by Phil999
yes, you can do this with an expression to save the last value.

Re: Hi, new here. Building my first project at the moment.

Posted: 19 Mar 2015 01:19
by slingdinger
Great! How would that look? I'm still getting the hang of how expressions and scripts work together.

Re: Hi, new here. Building my first project at the moment.

Posted: 20 Mar 2015 08:00
by Softcore
Check out the scripts in both Pad and Fader object! ;)

Re: Hi, new here. Building my first project at the moment.

Posted: 23 Mar 2015 22:04
by slingdinger
Thank you, that's exactly what I needed! Makes sense now.

Re: Hi, new here. Building my first project at the moment.

Posted: 18 Apr 2015 10:39
by group
I'm still getting the hang of how expressions and scripts work together.???

Re: Hi, new here. Building my first project at the moment.

Posted: 19 Apr 2015 21:58
by Softcore
Expressions are just "variables" you "create" and name as you want (either inside objects or globally).

The whole thing then, with scripts is that you make them "execute" when something happens to an expresion - for example to make a script execute when a button is pressed, you create a script : on Expression, x, any

Then inside the scripts you are free to do what you want with your own expressions in a logic - mathematical form so that you can get the result you are after. Thats the philosophy in a nutshell - so to answer your question, scripts work together with expressions in the ways YOU want - how you instruct them to do so, inside the scripts.

;)

Re: Hi, new here. Building my first project at the moment.

Posted: 19 Apr 2015 22:09
by Softcore
Lets look at the example above.

Inside the "pad" object we create an expression we call "last". We leave it blank, that is we dont give it any discreet value (we could if we wanted).

Then we have used a script which we named "setlast" because thats what we plan to do with it - "store" the last value of our fader in the expression "last".

Lets analyze this bit though - what do we mean, when we say "save the last fader value".
The LAST fader value is whatever value the fader has, WHEN WE LET IT GO (untouch).

A haaaaa, bright moment: the z variable of objects goes 1 when we touch them, 0 when we let them go.

So....... if we can have way to "store" the fader's value WHEN we let it go....then THAT value is the "last" value we want the fader to return to, when we let go of that "pad".
Easy then, the script we created "setlast" needs to be "executed" when we let go of the fader, that is
on expression z, falling to zero (down arrow)

Code: Select all

last=x;
Having done that, we then go to our pad.
Now all we have to do, is instruct the pad to get the fader to 0 when we press it, then make the fader return to the last value when we let it go.

Thus we end up with the script setfader which resides inside the pad button - remember the x of a Pad object is 1 when the pad is pressed, 0 when the pad is released.
on expression x, any

Code: Select all

if (x)  Fader.x=0;
means: if Pad.x is anything but 0 (if the Pad is pressed), get the fader down to zero

Code: Select all

else Fader.x=Fader.last;
means: else (if Pad.x is zero, if Pad is released) go get the value stored inside Fader object named "last" and make the fader go to THAT value. But that value was set the LAST time we let go of the fader, due to our first script, "setlast".

Re: Hi, new here. Building my first project at the moment.

Posted: 27 Apr 2015 12:08
by sosad
Inside the "pad" object we create an expression we call "last". We leave it blank, that is we dont give it any discreet value (we could if we wanted).

Then we have used a script which we named "setlast" because thats what we plan to do with it - "store" the last value of our fader in the expression "last".

Lets analyze this bit though - what do we mean, when we say "save the last fader value".
The LAST fader value is whatever value the fader has, WHEN WE LET IT GO (untouch).