New user....trying to make a new template...question please.

Discuss Lemur and share techniques.
RonF
Newbie
Posts: 12
Joined: 24 Jul 2013 18:52

Re: New user....trying to make a new template...question ple

Post by RonF »

Never mind....figured it out by following an earlier thread on the topic (thanks once again to Softcore!)
Softcore
Regular
Posts: 1613
Joined: 04 Nov 2012 08:34

Re: New user....trying to make a new template...question ple

Post by Softcore »

Did you check out this one?

http://forum.liine.net/viewtopic.php?f=34&t=3022

edit: oh lol, JUST saw your reply that you figured it out!
RonF
Newbie
Posts: 12
Joined: 24 Jul 2013 18:52

Re: New user....trying to make a new template...question ple

Post by RonF »

Once again trying to figure out some script language.

So you've demonstrated how to cause a switch, pad, custom button, menu...each to change tabs in a separate container. But what about a knob? I have knob which sends Midi CC 60 for a range of 0-127. I want it to change tabs in a separate container if the CC range is between 0-41, 42-96, 97-127. As I scroll through the knob range, I want it change tabs depending on where the CC value is.

So I figure its an "if" and "else if" type of script. Something like: If val x = (0-41) selecttab (container, 0); else if val x = (42-92) selecttab (container, 1);

I think I'm close....but I cannot get it to work.

Any advice please...

: )
Softcore
Regular
Posts: 1613
Joined: 04 Nov 2012 08:34

Re: New user....trying to make a new template...question ple

Post by Softcore »

Yup you got the logic right but you 've missed a tiny detail. x is always a number between 0 and 1 - it then gets multiplied (internally in Lemur) by 127 so that the midi output gets a range of 0 to 127 (notice in the midi mappings window the, active by default, "scale, 0 to 127").

So, to make the same thing in your script:

Code: Select all

if (x*127<=41) selecttab(Container, 0);
else if (x*127<=92) selecttab(Container, 1);
else selecttab(Container,2); //this is the last range, 93-127//
RonF
Newbie
Posts: 12
Joined: 24 Jul 2013 18:52

Re: New user....trying to make a new template...question ple

Post by RonF »

Ahhh...that's perfect. Thank you so much. I would not have figured the "x*127" out. Really appreciate the assist!
Softcore
Regular
Posts: 1613
Joined: 04 Nov 2012 08:34

Re: New user....trying to make a new template...question ple

Post by Softcore »

No prob! Keep that multiplication thing in mind because it becomes handy in many occasions. Everything in Lemur is treated as a floating number between 0 and 1. Anytime we want a different range we just multiply x (or any other expression) with the range itself.

As examples, think of a monitor object which we want to display a percentage amount of a knob : knob.x*100

;)
RonF
Newbie
Posts: 12
Joined: 24 Jul 2013 18:52

Re: New user....trying to make a new template...question ple

Post by RonF »

Great info. Thanks again!
Post Reply