Changing gauge label color/spacing on main menu

Hi -- on the main menu, default gauges of each actor have labels on each gauge (HP, MP, TP).

It's in a light blue, and if you change these labels with a plugin, MV smooshes the font so that they all take up the same amount of horizontal space. If you change the labels to anything longer than 2 characters, it looks very bad.

I've been trying to find where I can edit code directly (or locate a plugin) to:
  • Remove this font space limitation, and
  • Change the color from light blue to something else
I recall long, long ago I found the answer to the color issue, and was able to input a separate color value directly to change this. But despite extended searching, I can't re-find that answer, and I was never actually able to locate a solution to the label "scrunching" issue, which is the bigger deal. I'd love to have longer labels for these gauges!!

Thank you for your thoughts and time :LZScheeze: :LZSgrin: :LZScheeze:
You could write a simple plugin to do this quite easily. Here is the original function for drawing HP gauges (and accompanying text).

Code:
Window_Base.prototype.drawActorHp = function(actor, x, y, width) {
    width = width || 186;
    var color1 = this.hpGaugeColor1();
    var color2 = this.hpGaugeColor2();
    this.drawGauge(x, y, width, actor.hpRate(), color1, color2);
    this.changeTextColor(this.systemColor());  //this is what sets the text colour
    this.drawText(TextManager.hpA, x, y, 44);  //44 is the text width
    this.drawCurrentAndMax(actor.hp, actor.mhp, x, y, width,
                           this.hpColor(actor), this.normalColor());
};

So if you were to save a copy of this function into a text editor, change "this.systemColor()" to something different (I think the format for this is just hex codes eg: "#ff00aa") and change the 44 to a larger number then save it with the extension .js your hp gauges should have wider and different coloured text.

In the same document you can do the same with the functions "drawActorMp" and "drawActorTp", you can find the functions if you search the rpg_windows file.

EDIT: You'll need to add the new file to your plugin folder and add it to your project for it to take effect.
You could write a simple plugin to do this quite easily. Here is the original function for drawing HP gauges (and accompanying text).

Code:
Window_Base.prototype.drawActorHp = function(actor, x, y, width) {
    width = width || 186;
    var color1 = this.hpGaugeColor1();
    var color2 = this.hpGaugeColor2();
    this.drawGauge(x, y, width, actor.hpRate(), color1, color2);
    this.changeTextColor(this.systemColor());  //this is what sets the text colour
    this.drawText(TextManager.hpA, x, y, 44);  //44 is the text width
    this.drawCurrentAndMax(actor.hp, actor.mhp, x, y, width,
                           this.hpColor(actor), this.normalColor());
};

So if you were to save a copy of this function into a text editor, change "this.systemColor()" to something different (I think the format for this is just hex codes eg: "#ff00aa") and change the 44 to a larger number then save it with the extension .js your hp gauges should have wider and different coloured text.

In the same document you can do the same with the functions "drawActorMp" and "drawActorTp", you can find the functions if you search the rpg_windows file.

EDIT: You'll need to add the new file to your plugin folder and add it to your project for it to take effect.

This is literally exactly what I needed and I am very grateful for your time and help. Confirmed that this works super easily.

I knew it was somewhere in that function, I just couldn't parse what was what well enough.

Thanks again Silva, that was awesome.

EDIT: While this works fine with Hp and Mp, the situation appears a little more complicated with Tp, and I've not been able to find an answer in testing.

The Tp function is:

Window_Base.prototype.drawActorTp = function(actor, x, y, width) {
width = width || 96;
var color1 = this.tpGaugeColor1();
var color2 = this.tpGaugeColor2();
this.drawGauge(x, y, width, actor.tpRate(), color1, color2);
this.changeTextColor(this.systemColor());
this.drawText(TextManager.tpA, x, y, 44);
this.changeTextColor(this.tpColor(actor));
this.drawText(actor.tp, x + width - 64, y, 64, 'right');
};

This function is harder for me to understand. Changing the 44 where it was changed for Hp and Mp doesn't work. Also, Tp has the additional drawText since it isn't showing a Max number.

I'm curious as to why changing the drawText doesn't work the same way as the others. Any thoughts?
As Window_Base is used to construct quite a few windows (almost all if I'm not mistaken) I've assumed that this function is being inherited by all windows, this might not be the case. The reason for this is probably due to another plugin overwriting the drawActorTp method on specific windows rather than on Window_Base.

The easiest way to check if this is the issue is to just turn off all your plugins except the one you've made yourself. If the TP gauges now have longer text and different coloured writing you can be sure it's another plugin causing the issue.

Moving this to Learning Javascript.

As Window_Base is used to construct quite a few windows (almost all if I'm not mistaken) I've assumed that this function is being inherited by all windows, this might not be the case. The reason for this is probably due to another plugin overwriting the drawActorTp method on specific windows rather than on Window_Base.

The easiest way to check if this is the issue is to just turn off all your plugins except the one you've made yourself. If the TP gauges now have longer text and different coloured writing you can be sure it's another plugin causing the issue.

What an unreal experience it was to turn off all plugins, first of all!

I spent some time turning on plugins one at a time. I wasn't able to isolate the issue, so I went back to having all plugins on, and just experimenting where the new gauge plugin label was placed in the plugin list. It was bewildering how unpredictable the results were.

I eventually determined that the Yanfly Skill Core plugin was doing some rewriting to that function that was affecting it. It works fine now.

Really gotta thank you Silva! I'm a noob about this and previously didn't dare dive too far into the js of plugins, now I'm not afraid to dig in and troubleshoot these things properly.

Please mark as solved!

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/changing-gauge-label-color-spacing-on-main-menu.118098/