Hard to explain this without the patch, so i have attached it here.
in 'global_function()' , I have this line:
Monitor.monitor_value = getexpression(Fader_1,'x') + 1;
but i don't want "Fader_1" in there, i want something like getobjectparent()... so that my global function can be called by any Faders, not just Fader_1.
so i tried getobjectparent(), and i tried getobject(), but neither of them were doing what i wanted. Is there some trick i'm missing?
reference the parent object in a globally defined funtion
reference the parent object in a globally defined funtion
- Attachments
-
- global_func.jzml
- (3.46 KiB) Downloaded 88 times
Re: reference the parent object in a globally defined funtio
Hi
Maybe come at it slightly differently - just get the Fader to send the value to the function . . .
global_function(x) -(you pass a value along as x)
Monitor.value = x + 1; // don't need to recast as monitor_value and then to value just use Monitor.value - samething
Fader_script becomes Execute on Expression 'x'
global_function(x); // this sends the local x value to the function which adds 1 and puts it to the monitor value
You can duplicate the Fader multiple times and they will all post to the same Monitor object
Is that what you wanted??
MM
Maybe come at it slightly differently - just get the Fader to send the value to the function . . .
global_function(x) -(you pass a value along as x)
Monitor.value = x + 1; // don't need to recast as monitor_value and then to value just use Monitor.value - samething
Fader_script becomes Execute on Expression 'x'
global_function(x); // this sends the local x value to the function which adds 1 and puts it to the monitor value
You can duplicate the Fader multiple times and they will all post to the same Monitor object
Is that what you wanted??
MM
iMac 2.8G i7 12G 10.6.8/10.7.2, Legacy Dexter/Lemur, Liine Lemur/iPad2, KMI SoftStep, 12Step & QuNeo , B-Controls, Mackie C4 etc
MaxMSP, Live Suite, Native Instrument stuff, etc Modified Virtual Guitar System etc All Projects/Modules © CC-BY-NC-SA[*][/b]
MaxMSP, Live Suite, Native Instrument stuff, etc Modified Virtual Guitar System etc All Projects/Modules © CC-BY-NC-SA[*][/b]
Re: reference the parent object in a globally defined funtio
but...i thought functions didn't take arguments?Macciza wrote:Hi
global_function(x) -(you pass a value along as x)
can you have a look at my patch and modify it so it does that???
Re: reference the parent object in a globally defined funtio
by the way, i know in this case it would be much easier just to send the Fader_1.x value directly to the monitor... but this is just an example patch, which demonstrates what i wish to achieve.
I need to learn this process: ie, how to declare global functions and then use them inside my faders, switches, etc
I need to learn this process: ie, how to declare global functions and then use them inside my faders, switches, etc
Re: reference the parent object in a globally defined funtio
oh....!
just made a global function by typing 'global_function(x)' and that worked
please ignore my stupidity
i'm learning lemur and script coding both at the same time.
just made a global function by typing 'global_function(x)' and that worked
please ignore my stupidity
i'm learning lemur and script coding both at the same time.
Re: reference the parent object in a globally defined funtio
woo!
i got it!
sorry about the noise and silly comments....Macciza, your method is exactly what i needed
i got it!
sorry about the noise and silly comments....Macciza, your method is exactly what i needed
- Attachments
-
- global_func2.jzml
- (3.41 KiB) Downloaded 88 times
Re: reference the parent object in a globally defined funtio
Hi
Basically functions can be defined to either take arguments or not as needed by naming them appropriately
global_function(x) means it takes one arg that is accessed in the script as 'x'
Additional args need additional vars ie global_function(x,offset) and use Monitor.value=x+offset and send global_function(x,2) from the Fader script
Hope that makes sense
MM
Basically functions can be defined to either take arguments or not as needed by naming them appropriately
global_function(x) means it takes one arg that is accessed in the script as 'x'
Additional args need additional vars ie global_function(x,offset) and use Monitor.value=x+offset and send global_function(x,2) from the Fader script
Hope that makes sense
MM
- Attachments
-
- global_func3.jzml
- (23.1 KiB) Downloaded 98 times
iMac 2.8G i7 12G 10.6.8/10.7.2, Legacy Dexter/Lemur, Liine Lemur/iPad2, KMI SoftStep, 12Step & QuNeo , B-Controls, Mackie C4 etc
MaxMSP, Live Suite, Native Instrument stuff, etc Modified Virtual Guitar System etc All Projects/Modules © CC-BY-NC-SA[*][/b]
MaxMSP, Live Suite, Native Instrument stuff, etc Modified Virtual Guitar System etc All Projects/Modules © CC-BY-NC-SA[*][/b]
Re: reference the parent object in a globally defined funtio
awesome. yeah....i understand ( i hope)