3

I'm working on a developer console system for my game, and I'm currently working out how implementing variables will work. At first, I thought I'd just use variable pointers to change variables that belong to other objects, but it seems GDScript doesn't support them. Is there any way to do this, and if not, what are my alternatives?

mdkael
  • 31
  • 4

1 Answers1

4

Maybe you can create a dictionary with variable names as keys, and their values as dictionary values. Then, if the player will define a variable a in his code and set it to 10, your dictionary will need to change from

{}

to

{'a': 10},

and when the player will change the variable a to 11, your dictionary should update to

{'a': 11}.

If you have a simple console without objects with their own variables, just create a single dictionary, and you'll be done. Otherwise, if you have objects, create a similar dictionary for each of them. If your console can support variables without names, you should try a different way of solving this problem.