[SOLVED] Problem with an expression

Hello. My problem is simple: I’d want to write an expression like GlobalVariable("string"), but I don’t know how to do this. Does anyone know if there is a way? Thanks.


No, my variable is a number, I’d want that the variable’s name is a string.

You can name a variable.
Set variable (string) to number.

I don’t understand what you want

To be clear, A Variable name should always be a String.

GD doesnt like variables named a number.

You are choosing “Value of a global variable” instead of “String of a global variable”.

Sorry, I will try to explain myself better: I’d want that with a string expression (like "string") I can call the global variable whose name is the string expression.

Hi I don’t know if is this you want.
Think you can use


if you want to dynamically access a variable via string you can only use structures i think.
just use a head variables, like Variables.Dynamically_changeable_values.
and your string Variable.

You want to add +1 to one of your weapon variables.
use a structure with weapon.Bow weapon.sword etc
then set your string to the name of the variable.


Yes, that’s what I meant. So I am forced to create a structure and write GlobalVariable(parent["string"]), did I get it right.
Thanks, I just wanted to make sure there wasn’t another way to dinamically access a variable.