General

Execute scripts on child objects

Started by bval123 on .

Sign in or create an account to join the conversation.

6 posts

Topic starter
I have some scripts inside of a container that I'd like to be executed from its parent interface:
-- Interface
--- ScriptA
--- Container
----- ScriptB
E.g., inside of ScriptA, i'd like to be able to do something like
Container.ScriptA()
.

Currently I'm handling this pattern by having an expression that I set from the parent, and a script inside that executes "on expression".

Any ideas?
I'm a little unclear, you want to trigger ScriptA() from inside ScriptA()?? Or did you mistype and meant trigger Container.ScriptB() or...

Maybe your question is different, but if you don't already know: you execute scripts that are set to 'Manual' by just typing their name.
So if ScriptB() was set to execute 'Manual', then in ScriptA() you would just type: Container.ScriptB();
That would execute ScriptB()

Is this your question, or something else?
To clarify, and to show whats not working:
interface
  button
    scriptA()
  container
    expA
    scriptB()
I want to execute scriptB from scriptA (basically, having a button that is a sibling to a container that triggers a script inside that container). This currently doesn't work and gives me a syntax error.
// inside ScriptA, set to trigger on expression 'x' to serve as a click handler for button

// this works
setexpression(container, 'expA', 1);

// this is a syntax error
container.scriptB();
Does this example help you? Obviously you would never set things up like I did in my example, but just to show how you manipulate child expressions/scripts. I only use setexpression if I need to use a string name.

(by the way i'll probably delete the attachment after you see it)
Thanks for the example, it was more or less the setup I had.

The problem was embarrassingly just a typo in a different part of the template that was causing issues with the call to the script, I've got it working now :)