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.

Help needed with simple script command in eventing

Im not sure if there is a separate script help forum. I looked but didnt see one. My question/request is pretty simple. In RM2K3 in event "scripting" there was an option in the variable section, to reference a variable by the value of another. An "indexing" variable if you will. No such option exists in RMXP.

I was hoping someone could tell me how to write a simple one or two line script in ruby that I could insert to serve that purpose. I hope Ive described what Im talking about sufficiently enough for people to understand what it is I am asking for. Any help would be appreciated. :)
 
<scratches head> Ummm... it would probably be easier to answer if you put it in context. What do you want to use this for?

That being said, If you want to store a number in variable 1, then read variable n, where n is the value of variable 1, you can use the script statement: $game_variables[$game_variables[1]] to access the value of the other variable.

The question is, what do you want to do with that value once you have it? You could, for example store it in variable 2 using:

$game_variables[2] = $game_variables[$game_variables[1]]

or use it in a conditional branch:

$game_variables[$game_variables[1]] > n # where n is a value or another statement.

Be Well
 

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