Page 1 of 1

switch modifying

Posted: 30 Jan 2012 20:43
by vj skulpt
Hi guys,
I've been trying to understand expression's and scripting with limited success. I've read through the guide and its not making much sense to me.
Can anyone explain how to script one switch to turn lots of other switches off. I think i need to create an "action" script on expression, but here's where i get lost:
Correct me if i'm wrong, an objects x value is not an "attribute". So what command do i need to script to change the x value of another object?

If i can get this bit right i should have a fully working OSC sending and feedback template for Modul8, and i'll be happy to share it.

Re: switch modifying

Posted: 30 Jan 2012 20:48
by vj skulpt
hmm, maybe "setexpression" is the one?

Re: switch modifying

Posted: 31 Jan 2012 00:45
by vj skulpt
No worries, i sussed it out; Action script, on expression x, custom button.x=0; =)

Re: switch modifying

Posted: 31 Jan 2012 00:49
by brianc
Setting expressions in scripts is done directly. For a script to set the x value of the current object:

Some direct value:

Code: Select all

x = 21;
The another object's x value:

Code: Select all

x = otherObject.x;
To have the script runs when a value changes, set the script to run "On Execution", and put x in the box next to that if you want it to run whenever the current object's x value changes, or put otherObject.x if you want it to run whenever the x value of another object changes.

Since you're doing one switch, I'd recommend having a script for each of the objects you want to be controlled by the one switch (you can copy and paste this into each of them). Set the script to run "On Execution" and put theControlObject.x in the box, where theControlObject is the name of the one switch that affects them all. Then the script can be as easy as:

Code: Select all

x = theControlObject.x