How do I have my game state the name of a variable?

Okay so basically I'm making an event that tells the player how many troops they have based on the current number left in each variable.


I want to tell the player the name of the Variable as well as the current set number for said variable.


Example: Foot Soldiers: 10


               Pilots: 5


               Sea Captains: 2


How would I accomplish this?(I should also note that these variables will be fluctuating frequently but that shouldn't be a factor but if it is, i'm saying this now)
$data_system.variables is the array that contains the variable names.  So if you want variable 5, you'll use $data_system.variables[5]


Similarly, $data_system.switches is the array that contains the switch names.
So how do I get it to state this in a message box?
just one thing. Since it's on the MV boards it's $dataSystem, $data_system is for Ace.
Sorry - I looked at your avatar and saw Ace.  Didn't think to confirm location.


You'd need to do a Control Variables, and put that into the Script box.  Then you could just use the variable in the message box.


So if variable 5 contains the number of foot soldiers, and variable 10 is a 'use for whatever purpose' variable, you'd do something like this:

Code:
Control Variables: [10: Stuff] = Script: $dataSystem.variables[5]
Show Text: \v[10] - \v[5]



If you wanted to show 3 variables with their labels in a single text box, you would need 3 'dummy' variables.
You lost me, how does putting this varible in the script section which I could easily select at the top of the window to begin with, going to allow me to display this in a message box?
You are putting the variable's description into a second variable, which you can then use in a text box.
Alternatively, you use one variable for displaying names and assign to it every time you plan to display a name.
Spoiler
XAxeEEG.png






 
Not signed in




 


Not signed in






Found this on the Ace forums, but it should work in MV as well. 🙂


In the message box, just type \v[x] to show the string/name of the variable you set. (X being the variable's ID)

Original thread: https://forums.rpgmakerweb.com/threads/how-do-i-have-my-game-state-the-name-of-a-variable.62472/