Page 1 of 1

Problem to execute a script

Posted: 05 Feb 2012 17:50
by MrOT
Hello out there.

Got a Problem to execute a script.
I wanna set the x value of a Fader to 0 when hit a button.

The script tells me no problem, but nothing happen if i hit the Button!

my Script:

Code: Select all

decl n= 0;
setattribute(Container5.Fader74, 'x', n);
and my hierarchy is in the picture!

Whats going wrong?

Re: Problem to execute a script

Posted: 06 Feb 2012 02:04
by Macciza
Hi

The reason is that 'x' is not an attribute, it is a variable . . .
Attributes refer to the state of the object, how it presents itself or reacts to input .
Variables are the data part of the object.

So maybe reread sections 6.9 Using containers and 10.4 Attributes.
The script for your button will be something like

Code: Select all

Container5.Fader74.x=0;
Cheers
MM

Re: Problem to execute a script

Posted: 06 Feb 2012 09:29
by axel_liine
Exactly. Note that variables are also called "expressions'". Another function with the same result :

Code: Select all

decl n= 0;
setexpression(Container5.Fader74, 'x', n);
It's less efficient in this case, but 'setexpression' can be used when iterating over an array of objects for example.

Re: Problem to execute a script

Posted: 06 Feb 2012 12:26
by MrOT
That's the Reason!

THX very much!