Self reference conditional statement

Discuss Lemur and share techniques.
Post Reply
worldoftwilights
Newbie
Posts: 8
Joined: 25 Jul 2013 01:13

Self reference conditional statement

Post by worldoftwilights »

Hello!

I was wondering if it is possible to have this sort of code:

if(nameoftheobject==banana1) do this
if(nameoftheobject==banana2) do that


this is because I have a cluster of the same object and since i change the code quite a bit, I would love the possibility to just copy and paste another element (which will have a sequential number) and get the result done :)

Hope I made myself clear, let me know.

1000 thanks
Bye for now.
Gio.
Softcore
Regular
Posts: 1613
Joined: 04 Nov 2012 08:34

Re: Self reference conditional statement

Post by Softcore »

With this script residing inside an object

Code: Select all

getattribute(getobject(), 'name') 
The name of the object will be returned.
Macciza
Regular
Posts: 1315
Joined: 07 Dec 2011 04:57
Location: Sydney, Australia.

Re: Self reference conditional statement

Post by Macciza »

Hi
Another option is a variable in each object with the same code - this can then be easily queried from anywhere . . .

More to the point though is where is the code going to run from, what are you wanting to do, what are the other objects etc etc
Code can be structured in numerous ways to achieve the same thing - with varying performance and for various reasons
Encapsulation of objects into containers as modules can help in easing duplication issues

So sorry but no hard and fast answer here - more info needed . . .

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]
worldoftwilights
Newbie
Posts: 8
Joined: 25 Jul 2013 01:13

Re: Self reference conditional statement

Post by worldoftwilights »

Softcore wrote:

Code: Select all

getattribute(getobject(), 'name') 
Thanks man! I'll try it ASAP!
Macciza wrote:Hi
Another option is a variable in each object with the same code - this can then be easily queried from anywhere . . .
MM
Thanks Macciza, that's exactly how I've solved it in this moment.

Every object in the cluster has an index variable inside the object and I change only that.
It seems to work smoothly, I'll let you know.

You're right about the lackness of information, but I was asking the question while writing the code, while thinking about the logistics of the interface... Everything was "in the cloud" and I couldn't give more info on that, because I didn't know exactly where I was going with the code :) .


Thanks a lot guys!
See you soon.
Post Reply