SOLVED Dynamically calling parent variables

I’m trying to dynamically call the parent variable. In this example, BumpyTheRobot has an object variable named “type”, which equals a string: “Damage”. There is a sprite named Damage with an object variable called “attack”, which equals 10.

I tried to call it like this, but it’s red:

I also tried calling it as Variable(testVar.attack) which doesn’t make it red, but doing that makes testVar a struct, with “attack” created as a child for it. It then holds 0, not 10.

Is there a way to dynamically call the parent variable? Thank you!

IDK of an easy way using events. It would probably be easier in JavaScript.

To get the object variable you need to pick the object first. While you can use string comparison to check an object name, I don’t think that would pick it.

What exactly are you trying to do? Maybe there’s a simpler way like linking or a 2nd object variable or scene structure variables.

It was a really convoluted way of storing values. I fiddled around with it more, and I managed to get it working with a struct value. Thank you!

1 Like

We all have those moments when something sounds good until we try to execute it. I like to help but I also like the challenge. I’m reminded of the phrase “the question isnt can we do it but should we do it?”

1 Like