General

Problem to execute a script

Started by MrOT on .

Sign in or create an account to join the conversation.

4 posts

Topic starter
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:
decl n= 0;
setattribute(Container5.Fader74, 'x', n);
and my hierarchy is in the picture!

Whats going wrong?

faderscript.jpg
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
Container5.Fader74.x=0;
Cheers
MM
Exactly. Note that variables are also called "expressions'". Another function with the same result :
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.