How do I use a variable to access structure children

Hi. I’m trying to make a hotspot object the user can click, and then it will respond by, for example, taking them to a different level. My idea was to have a single hotspot object, with a variable “instanceName” that would have the unique name of this hotspot, and then a big structure with all the different hotspots in the game paired with, for example, a string to display when clicked, or a new level to load. So the structure would look like:

hotspots.texts.well - returns a string that I can use in a “display this string” function

hotspots.location.door - returns the name of a new level, stored as a string, that I can then use in a “go to this level” function.

This way I can see them all in one place.

I am open to the suggestion that this is a totally stupid way to organise this and to do it some other way, but I really think I’ve almost got it working. The issue seems to be in calling the structure. If I use this expression:
GlobalVariableString(hotspots.texts[Variable(object_name)]) I get 0 (where “object_name” is a local variable I’ve already defined and populated with the instanceName, for eg “well”

I’ve tried every permutation of the syntax I can think of. So

  1. Am I making an obvious syntax mistake?
  2. Am I going about this task backwards?
  3. Is there a central repository of this sort of syntax. The documentation seems very good but only covers the main introductory stuff. Is there a way to find the exact syntax and options for every expression?

many thanks

Ok so it appears there was at least one permutation of syntax I had not tried, as the correct answer was:

GlobalVariableString(hotspots.texts[VariableString(object_name)])

However questions 2 and most especially 3 still apply. Is there any documentation that goes into that sort of level of detail?

The wiki talks about using child variables dynamically about 2/3rds down: Variables - GDevelop documentation

It also has a full expression reference, but is nust a definition and paraneter list: Expressions reference - GDevelop documentation

Thank you! This is exactly what I was looking for…