Page 2 of 2

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

Posted: 29 Jul 2013 05:08
by RonF
Never mind....figured it out by following an earlier thread on the topic (thanks once again to Softcore!)

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

Posted: 30 Jul 2013 08:48
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!

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

Posted: 05 Aug 2013 00:29
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...

: )

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

Posted: 05 Aug 2013 05:47
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//

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

Posted: 05 Aug 2013 23:09
by RonF
Ahhh...that's perfect. Thank you so much. I would not have figured the "x*127" out. Really appreciate the assist!

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

Posted: 06 Aug 2013 06:46
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

;)

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

Posted: 06 Aug 2013 17:05
by RonF
Great info. Thanks again!