Page 1 of 1

Referencing revisited

Posted: 01 Jul 2014 02:20
by joebataz
In my project are 2 interfaces, Faders and Sequencer.
In Faders is a fader named XFade
In Sequencer is a fader named XFadeGhost

I would like these faders to have the same value. If I move XFade I want the x value to be the same in XFadeGhost. If I move XFadeGhost I want XFade x value to be the same.

WITHOUT using an OnFrame construct how do I get these 2 faders to see each other? I have triede multiple combinations of findobject, setattribute, etc. and I just can't get the value from one into the other without using a global variable and an OnFrame construct.

TIA for any help!!

Thanks,

joeb

Re: Referencing revisited

Posted: 01 Jul 2014 04:43
by Joe Soap
Use an Alias?

Re: Referencing revisited

Posted: 01 Jul 2014 07:40
by Macciza
One approach is to use execution as a 'listener' ...
Under XFade set up a script called setval executing on expression XFadeGhost.x - x = XFadeGhost;
Mirror the script with alternate names in the other object
Essentially the script listens to the expression and sets the local x to that value when it changes.....
MM

Re: Referencing revisited

Posted: 01 Jul 2014 12:46
by Softcore
Change both faders physics from the default "interpolate" to "none"

Add script in XFade, on expression x, any

if (z) XFadeGhost.x=x;


add script in XFadeGhost, on expression x, any

if (z) XFade.x = x;

Re: Referencing revisited

Posted: 01 Jul 2014 12:50
by Softcore
Also this might work with any physics desired

Add script in XFade, on expression x, any

if (!XFadeGhost.z) XFadeGhost.x=x;


add script in XFadeGhost, on expression x, any

if (!XFade.z) XFade.x = x;

Re: Referencing revisited

Posted: 02 Jul 2014 00:53
by Macciza
I find the opposite way a more objecty way of doing things....
Ie the Fader that is changing has the code to change itself based on the execution expression
This way looking at the object itself shows what it does, rather then another object controlling it which you need to find...
It keeps all the objects actions encapsulated in itself making moving or duplicating much simpler as well....
MM

Re: Referencing revisited

Posted: 02 Jul 2014 06:22
by Softcore
Indeed, I cant argue with that! ;)

Re: Referencing revisited

Posted: 16 Jul 2014 23:48
by joebataz
Youse guys!!!

That's why I love this forum, multiple answers. But I found the easy one;

LEARN HOW TO SPELL!!!
(Smack! the sound of a well placed smack to my forehead)

Thanks folks! Maybe I shouldn't have taken 3 engineering classes at the same time and get sleep instead...

Best to all,

Joe B

Re: Referencing revisited

Posted: 29 Jul 2014 02:24
by vav
Macciza wrote: Under XFade set up a script called setval executing on expression XFadeGhost.x - x = XFadeGhost;
Mirror the script with alternate names in the other object
For anyone as literal minded as me, and as clueless about obvious scripting stuff . . . Play with it instead of wondering what assigning "XFadeGhost" to "XFadeGhost.x - x" might mean. Doh! I thought maybe that actually worked in Lemur. :oops:

"on expression XFadeGhost.x any" -- listen for any change to that x
"set local x to XFadeGhost.x" -- and take its value

So any reason not to use an alias if this is all you need? I can see how you'd want to start from this to get fancier than simply syncing x value.