Dynamically change window-border color?

G'morning, all y'all.

I'm looking for a way to change the border of a text window with some script call or command, much like how you can dynamically change the color of the window itself. (The idea is I'd like to change the text border color--not the text window--to match whoever is speaking.)

I'm aware that I can change the image itself in the Window.png file (which I plan on doing anyway), but I'm trying to figure out how to change only the color within the program. Ideally I'd also like to set some sort of default, even if I make the border image a mid/dark gray, but I don't even know if any of this is possible as is.

Thanks, y'all.
I don't know if you can tint just a portion of an image file like you're asking.

There are a number of plugins that let you change windowskins during gameplay, so you could just make separate windowskin files with the different border colors you want, then change between those.
You could write a plugin to shift the hue of the border sprite, but depending on what your window skin looks like that might not have the desired effect.

If you have more of a retro skin (e.g. NES style), you could dynamically draw a colored border with a plugin, but that gets into editing the bitmap sprites directly.

You didn't share any visual mockups, so I can't say if either of the above might work out.

The most practical approach might be a plugin that lets you specify a windowskin file based on a face graphic.
The correct term is window frame.
You can change color tone of the window frame sprite.
For example:
SceneManager._scene._messageWindow._windowFrameSprite.setColorTone([0,255,0])
The correct term is window frame.
You can change color tone of the window frame sprite.
For example:
SceneManager._scene._messageWindow._windowFrameSprite.setColorTone([0,255,0])
Thank you, this is exactly what I'm looking for. It's good to know its proper name, too.

However, it seems to conflict with Yanfly's Message Core, which results in the frame disappearing completely. I realize that this is now a plugin support question. Should I go ask there instead?
I don't think it has something to do with YEP message core. As far as I know it doesn't change the basic window.
How exactly do you use that? You are supposed to use that inside a event command.
I copied the line as written (with changed RGB values) into a Script event command. The event itself happens to be autorun. I tested it out, and the frame disappeared.

To make sure it wasn't something I was misunderstanding, I started up a completely fresh project, had an autorun event run the same script (followed by a show text command of course), and it worked perfectly.

Then I tested out the plugins I was using on that fresh project. GALV layer worked fine, YEP core worked fine. As soon as I activated YEP message core (with YEP core of course), without doing anything else at all, the frame disappeared again on my next test.
It works perfectly in my project, which has a ton of plugins in it, including Yanfly's Message Core.

1726281092569.png


I don't see why it would have any conflict, the Message Core doesn't reference the windowFrameSprite nor the setColorTone() method.

Perhaps post how you're actually using it - I don't see any reason why you would have some separate, autorun event. Just include the script call right before the Show Text command.
I created a completely clean project with no changes other than this event added. This is what I wrote up to test the script.
71217941d0edf5b25d09267452bbb1fb.png


Changing the trigger from Autorun to Action Button to Player Touch didn't change anything. The only difference between the frame being present and tinted, and disappearing, is that I turned YEP Message Core on. YEP Core is version 1.32, and YEP Message Core is version 1.19.
Okay - when I left my actual project and went to a new test, I can duplicate your issue.

I don't know why - I'm using that version of the Core and Message Core in my project, so there must be something else that's fixing it.

If I figure anything out, I'll let you know.

Edit: For some reason, it's the timing. If I turn off the Message Core, the event as you wrote it works as expected.

If I turn the Message Core on, take out the script call, display the show text window, then go into the console and enter the script command, the frame remains and changes color.

So something must be different about how the window gets created/drawn in the Message Core which causes setting the color tone before the window is opened to glitch. I didn't see it when I did my project test because I entered the code in the console, not as a script call in the event.
setTimeout(function(){SceneManager._scene._messageWindow._windowFrameSprite.setColorTone([0,255,0]);},1);

This should fix the problem. Though I don't know what happens in YEP message core after the window is loaded.
setTimeout(function(){SceneManager._scene._messageWindow._windowFrameSprite.setColorTone([0,255,0]);},1);

This should fix the problem. Though I don't know what happens in YEP message core after the window is loaded.

Unfortunately this only fixes the problem for the first instance of dialogue with the same color.

So if I have X different messages in a row, then only the first tints, and the rest have disappearing frames, even if I enter new events, even with this same message.

However, as soon as I swap to a new color, the first instance of that new color works for a single instance, after which the starting color works for a single instance, and so on.

Edit: I can make it work like so:
0bcb0ad4ccef09f4ff950ab13bd1a45a.png


But it causes a small but noticeable frame flicker, and it's pretty inelegant.
JavaScript:
setTimeout(function() {
    SceneManager._scene._messageWindow._windowFrameSprite.setColorTone([0, 255, 0]);
    SceneManager._scene._messageWindow._windowFrameSprite._refresh();
},
1);
This one should do.
JavaScript:
setTimeout(function() {
    SceneManager._scene._messageWindow._windowFrameSprite.setColorTone([0, 255, 0]);
    SceneManager._scene._messageWindow._windowFrameSprite._refresh();
},
1);
This one should do.
Unfortunately, this one also only applies to the first instance of a given color, after which the frames disappear. Much like my inelegant solution, I have to repeat this for each new textbox I want colored, and it still has a small but noticeable frame flicker.

Like I asked before, should I go and create a new topic in the plugins help forum/ask for this to be moved? This really seems like a plugin issue at this point.
Yeah it is strange but we don't call it a plugin bug because it doesn't break normal usage.

Also I tried removing the message window part from yep code, it fixed the message window. So maybe the problem is somewhere among those lines.

After investigating the code, I found it is not really a problem of yep, but an overlook of of the refresh code. To make it simple, if you set the size of the window without actually changing it (for example, window.width = window.width), the window will refresh its parts but some of the refresh code thinks it is not changed and forgo it (tint/color tone needs it because MV does it by creating a new bitmap so the texture must be updated).

Anyway, this is a small patch to the plugin.
JavaScript:
(function(alias){
Window.prototype._refreshFrame = function() {
    alias.call(this);
    this._windowFrameSprite._refresh();
};
})(Window.prototype._refreshFrame);
Thank you very much, it now works perfectly.

Before I call this solved, how should I credit you for the patch?
Thank you very much, it now works perfectly.

Before I call this solved, how should I credit you for the patch?
Just this forum profile should be fine.🙂

Original thread: https://forums.rpgmakerweb.com/threads/dynamically-change-window-border-color.171862/