I have a global text variable (WhereAmI) that stores the name of a sprite. I want to be able to use this variable to refer to this sprite's instance variables. I can't figure out how this would work.
For example, at the beginning of the game, WhereAmI is set to "Location1". The sprite Location1 has an instance variable of clue. I want to set a text object to contain the text from Location1.clue. Instead of referring directly to Location1, I want to use WhereAmI since I may want to pull clue from Location2 in another context. I can't use WhereAmI.clue, because the global variable WhereAmI has no instance variable clue.
I thought about using an if statement, but it doesn't look like those are implemented? That's a suboptimal solution anyway, I think.
In the end, I should probably store all this in an array or something and end up having to refer to Array[WhereAmI] or something. However, even if I do change the way I structure this particular action, using a variable to refer to a sprite seems like it could be useful.
Thanks for your help!