I'm eventing a character creation system. The bulk of this work is done--the problem arises when I want to display to the player suggestions on what classes she or he might do well to choose. Specifically, I want to flag "good" choices in blue or green and "bad" choices in orange or red. I'm looking to get a text box to result in the following coloration:
I can do this normally, adding appropriate text colors to stuff, but the problem is that these colors need to be derived from variables, depending on how well the character's stats match with the listed classes.
I can do this normally, as well (e.g., "\c[\v[x]]"). However, the text box's displayed contents are derived from strings stored in variables concatenated together in an order specific to the character's stats and class affinity (the bit at the beginning is a Yanfly message code). The three variables in this case are $game_variables[97], $game_variables[98], and $game_variables[99]:
I had to do this because the order of the classes that appear must be able to change, given one character or another's different stats and class affinities.
I've managed to calculate potential class affinities, and I've been able to arrange the classes in order of best to worst match, and I've been able to event it so the best-matched class (or classes if they're tied), second-best class(es), and worst-matched class(es) are displayed in the right order in the text box.
What I can't seem to do is embed the text box color codes in the variables containing the class names. I've gotten pretty close by doing this:
This is the result:
(Not including the double "\\" results in errors and script conflicts.)
I'd be willing to consider other ways (via event script calls) to get the colors in there, but I'm really a Ruby novice--not unfamiliar, but not yet fluent. I'm afraid I don't how to make certain variables stored as strings appear in the text box with a color attached to them outside of the "\c[x]" codes.
Anybody got a solution or a creative workaround that wouldn't be too onerous?
EDIT: Well, I didn't find a *complete* workaround, but I managed to event it so each "best"/"worst" class slot is tied to a variable, and another governs that class's color, and another governs the color of the dividing punctuation. I have a script that allows me to set a transparent color, which I did by default. So, when a class is deemed to be on one of the lists, its variable is set to the relevant class name, that list position's color is set to an appropriate color, and the delimiting punctuation is set to a different color. I'm still interested in a solution to the above, but it's not gonna break me to not have it.