Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Variables (again)

I didn't find anything on this so....

I'm making a little script. I need to know if it's possible to call a variable through its name instead of it's ID.

E.G.

Instead of
Code:
$game_variables[ID]

Something like
Code:
$game_variables[VARIABLE NAME]

So that the script does not need to be edited by everybody who uses it so that it works with a higher variable than I set. So that they can just name the variable to something, and it'll find that variable's name and work from that.
 
Code:
$game_variables[$data_system.variables.index(name)]

where name is the variable name you want

If you want I can write a new method (or overload methods [] and []=) so you can type the variable name or the id
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top