Page 1 of 1

check for a composition

Posted: October 25th, 2007, 3:27 am
by macbcn
Hello everyone,
I'm new here, I've searched through the forums but I haven't found what I need... I hope I've searched correctly and I'm not asking something that has already been answered. Sorry otherwise.

So, I would like to know if there is an expression that checks the existance of a determined composition within my project... I'll try to explain:

I have a composition with an object that only moves in circles. However, sometimes I need this object to do just what another object within another composition does. This other composition may be called "LEADER", for instance.

Basically, what I want to do is that my object moves in circles as long as the composition "LEADER" is not there, but if it is, I want my object to do what the object in the composition "LEADER" does.

The problem is that I do not know how to check whether this composition named "LEADER" exists within my project. I guess I could do it with a global variable, for instance, but I do not know how to set it up and make use of it.

Or maybe there is an expression that checks the composition names on my project... I don't know...

Anybody help, please?


Thanks a lot!!

Posted: October 25th, 2007, 5:39 am
by Atomic
You can always use a try/catch in an expression.

If Leader exists, the code will run, otherwise you will end up in the catch.

Expressions can not remember variables, so there is no such thing as a "global" for expressions.