MZ Allocate variable value to name association.

Hi everyone, I have a rather unusual request and i've looked into message macros but I don't believe this exactly leads to what I am after.

To put this into perspective, I'm devising a way for the player's party to display a level of skill in certain weaponry.
I have this done with values into variables but seeing simply a variable's number doesn't exactly tell you much in a literary sense
that alone the skill level.

For instance I have 5 levels of training, sort of like belt rankings in Taekwondo which go from colours like white to the highest level black (extra stripes for extended levels), like so I have devised 5 levels with names such as Novice, Apprentice, Expert, Elite, and Master. But I am having difficulty in displaying them in automatically in text windows.

For instance Novice is represented in a value of 1, while gradually it increases the value depending on the level of training so Apprentice = 2 etc etc.

But how can I display the value as a text abbreviation? or by the name of the variable or switches? Has anyone thought of this before in the context or RPG maker plugins?

Any help into this matter would be greatly appreciated as I feel i've exhausted alot of search efforts.
no need for a plugin at all - which is probably why you didn't find anything on this.

you can easily assign a string to a variable with the script option, you just need to declare is a string with " before and after.

Control variable: script and putting "Novice" into the script field will result in the next show text \V on that variable displaying the text Novice instead of a number.

The only tricky part is to remember which variables have been changed to strings because you can no longer use them in caclulations.
no need for a plugin at all - which is probably why you didn't find anything on this.

you can easily assign a string to a variable with the script option, you just need to declare is a string with " before and after.

Control variable: script and putting "Novice" into the script field will result in the next show text \V on that variable displaying the text Novice instead of a number.

The only tricky part is to remember which variables have been changed to strings because you can no longer use them in caclulations.
I'd recommend giving the variable a name that indicates it contains a string for keeping easier track of that.
Very interesting, I had no idea this was something that could be done without plugins. But then again I haven't come across a situation where I needed to do something like this until now.

Just so I'm assuming i'm on the same page, you are referring to this as an example?

Nov.png


Understandably I cannot assign a constant value when the Script is used, but if it's simply to display a name that equals a value that still tells me what number that variable ID is at correct? If I want to control value and display the number I can still display it by normal means after the text displays it on the first occurrence?
Very interesting, I had no idea this was something that could be done without plugins. But then again I haven't come across a situation where I needed to do something like this until now.

Just so I'm assuming i'm on the same page, you are referring to this as an example?

View attachment 261236

Understandably I cannot assign a constant value when the Script is used, but if it's simply to display a name that equals a value that still tells me what number that variable ID is at correct? If I want to control value and display the number I can still display it by normal means after the text displays it on the first occurrence?
A variable can only contain one value at a time, unless you make it an array or object, but that seems outwith the scope of what you're comfortable with right now.

If you set it to "Novice" then that is the value it will contain. It will have no reference to the number you've arbitrarily assigned to that text; how could it? Where would it get the association from when it currently only exists in your head?
you are referring to this as an example?
almost, you're missing the "

you need to put in "Novice"
Yep, I'm keeping it a pretty standard and comfortable scope of things, I just realized also I needed the quotation marks.

Nov.png



This is precisley what I am after, thank you all for your help!

Original thread: https://forums.rpgmakerweb.com/threads/allocate-variable-value-to-name-association.157308/