Page 1 of 1

Easy way to add multiple fader numbers to script?

Posted: 10 Feb 2013 15:19
by alloedee
Hello there.

Iam an working on some templates, with many multisliders and faders. In the template there is some reset/normalize buttons.

Iam using this script for resetting the sliders:

Code: Select all

MultiSlider.x=0.0;
But I was wondering if it is possible to make some kind of specific interval, like MultiSider1-Multislide32.x=0.0; so I dont need to inset all the numbers manually.

Example of that I have done so far for one reset button:

Code: Select all

MultiSlider33.x=0.0;
MultiSlider34.x=0.0;
MultiSlider35.x=0.0;
MultiSlider36.x=0.0;
MultiSlider37.x=0.0;
MultiSlider38.x=0.0;
MultiSlider39.x=0.0;
MultiSlider40.x=0.0;
MultiSlider41.x=0.0;
MultiSlider42.x=0.0;
MultiSlider43.x=0.0;
MultiSlider44.x=0.0;
MultiSlider45.x=0.0;
MultiSlider46.x=0.0;
MultiSlider47.x=0.0;
MultiSlider48.x=0.0;
MultiSlider49.x=0.0;
MultiSlider50.x=0.0;
MultiSlider51.x=0.0;
MultiSlider52.x=0.0;
MultiSlider53.x=0.0;
MultiSlider54.x=0.0;
MultiSlider55.x=0.0;
MultiSlider56.x=0.0;
MultiSlider57.x=0.0;
MultiSlider58.x=0.0;
MultiSlider59.x=0.0;
MultiSlider60.x=0.0;
MultiSlider61.x=0.0;
MultiSlider62.x=0.0;
MultiSlider63.x=0.0;
MultiSlider64.x=0.0;

Re: Easy way to add multiple fader numbers to script?

Posted: 12 Feb 2013 12:39
by alloedee
Bump,

I really need to find out if this is possible or not. Before I use alot of time on something stupid.

Plz help

Re: Easy way to add multiple fader numbers to script?

Posted: 12 Feb 2013 12:57
by Macciza
Hi
One way to do it is by using the findobject(name) or getfirst(object) functions to locate where you want to start . . .
And then use getnext(object) to step through the hierarchy . . .

Have a look at the while loop example in the User Manual . . .

MM

Re: Easy way to add multiple fader numbers to script?

Posted: 07 Mar 2013 13:48
by Softcore
I have bumped into a lot of occations where I needed such a function and I cant for the life of me, figure out what Im coding wrong here....

I've used 5 knobs in the example template but of course I would use such a code on a larger scale (more objects to be set)

What the hell am I doing wrong??

button, on expression x, risign from 0

Code: Select all

decl obj,i;
obj=findobject(Knob1); 
i=0;
while (i<5)
{
setexpression(obj,x,0.2);
getnext(obj);
i++;
}
I then press the button but the knobs do not change expression x.

here's the example template....6 knobs are in there, I want to make the 5 change (I put the 6th in there just to be sure I have the code correct, its supposed to stay untouched)

Re: Easy way to add multiple fader numbers to script?

Posted: 07 Mar 2013 14:13
by lABl
Attached an example, try with objects inside of container.

I got a finished project I wanted to release full of examples with kind of code,

Hope that helps,
Cheers,

Re: Easy way to add multiple fader numbers to script?

Posted: 07 Mar 2013 14:18
by Softcore
Ok I think I 've figured it out....

This works!

Code: Select all

decl obj,i;
obj=findobject('Knob1'); 
i=0;
while (i<5)
{
setexpression(obj,'x',0.2);
obj=getnext(obj);
i++;
}
Is there a more elegant, shorter code for this function or is this the best it can get?

the example template for anyone needing it...

Oooops just saw your post AB, thanks I 'll definitely check it out!

Re: Easy way to add multiple fader numbers to script?

Posted: 07 Mar 2013 14:22
by Softcore
I saw your example AB...Dont think Im a lazy guy - I have already seen this approach in the Lemur manual - i wanted to make it work outside a container! ;)

EDIT: I think this one is even better than my previous one.....

Code: Select all

decl obj = Knob1; 
while (obj!=Knob6)
{
setexpression(obj,'x',0.2);
obj=getnext(obj);
}

Re: Easy way to add multiple fader numbers to script?

Posted: 07 Mar 2013 14:34
by lABl
Ah no problem, so you are ready to go now ;)