Dynamically referencing a variable

How do I…

How do I use a value from an array in the name of a variable for a condition? Currently, my event looks like this.

Working Event

It correctly recognizes the database that I want and works great. But now I’m adding 2 more databases. I want to use an array with text values to replace the “Bottom” in my database name.

So, I’ve tried a multitude of different combinations of parenthesis, brackets, and prefixes to no avail.

I simply can’t figure out why this event doesn’t work.

Event

What is the expected result

I need the condition to run through every child in Bottom_DB, Midwater_DB, or Topwater_DB, based on which value from Lure_List is shown in the Equipped_Lure variable.

What is the actual result

It’s simply not recognizing my jumble of variable calls as “Bottom_DB”.

Your help would be much appreciated.:blush:

You can only use dynamic names for its children not the main variable.

So,if you had

Fruit.Apple

Then you could use

Set Type = “Apple”

And get the variable with Fruit[Type]

You couldn’t change Fruit or access it dynamically.

Just a tip. Put the at the beginning on a line by itself and the for each child as a subevent. You won’t need the trigger once. The at the beginning condition is enough.

As is, it’s still going to go through the variable on every frame it just won’t trigger any actions.

Awesome, thanks! I’ll be sure to do that!