[SOLVED] Window Status (Attributes) Refresh.

TL;DR version on the end. :]

My problem is about the "refresh" or "update". There's a plugin that i am adding this Status (Show Attributes) Window.

This is the:
Spoiler: Main Created Scene
Scene_PluginName.prototype.create = function() {
Scene_MenuBase.prototype.create.call(this);
this.createPluginNameHelpWindow();
this.createPluginNameStatusWindow();
this.createPluginNameBaseWindow();
this.createblabla();
this.createblablabla();
this.createblablablabla();
this.createStatusDummy();
this.refreshActor();
};

As a place holder, it shows as intented.
Spoiler: Print :)
j6tow3.jpg

The problem is, the alterations i do in this plugin windows does not update/refresh. If i gain 1 Att, i need to exit de screen and enter in the Scene again to manually update.

Here is the dummy status window:

Spoiler: Dummy Status Part
Scene_PluginName.prototype.createStatusDummy = function() { -> That is called up there
this._windowStatusDummy = new Window_StatusDummy();
this.addWindow(this._windowStatusDummy);
};

function Window_StatusDummy() {
this.initialize.apply(this, arguments);
};

Window_StatusDummy.prototype = Object.create(Window_Base.prototype);
Window_StatusDummy.prototype.constructor = Window_StatusDummy;

Window_StatusDummy.prototype.initialize = function() {
var width = 1680;
var height = 145;
var x = 240;
var y = 935;
Window_Base.prototype.initialize.call(this, x, y, width, height);
this.refresh();
};

Window_StatusDummy.prototype.refresh = function() {
this.contents.clear();
this.drawDummyStatus();
};

Window_StatusDummy.prototype.drawDummyStatus = function() {
var lineHeight = this.lineHeight();
this.drawAttributes(6, lineHeight * 0);
this.drawText('Perk Status', 6, lineHeight * 10);
this.drawIcon(86, 0, lineHeight * 3);
if ($gameSwitches.value(31) == true ) {this.drawText('31 on', 6, lineHeight * 11);}
else {this.drawText('31 off', 6, lineHeight * 11);}
};

Window_StatusDummy.prototype.drawAttributes = function(x, y) {
var lineHeight = this.lineHeight();
for (var i = 0; i < 4; i++) {
var paramId = i + 2;
var x2 = x + 188 * (i % 2);
var y2 = y + lineHeight * Math.floor(i / 2);
this.changeTextColor(this.systemColor());
this.drawText(TextManager.param(paramId), x2, y2, 120);
this.resetTextColor();
this.drawText($gameActors.actor(1).param(paramId), x2 + 120, y2, 48, 'right');
}
};

Question/TL;DR: Is there a way to put a automatically refresh/update as the numbers change ?

Thx in advance, i'm newbie and trying to learn. No need to rush an answer, it's a trivial question and appears to be simple but i didn't find specific answer not manage to success on "try and error" method. 😀
There is a way. Via other windows.
For example you have a command window what will equip items:
Code:
Window_RandomEquipCommand.prototype.equipItem = function () {
// function code that is not interesting for us right now
SceneManager._scene._windowStatusDummy.refresh();
}
I spent about 2 hours here trying to figure it out, could you please elaborate a more in depth an example ?

just a little bit more 😅
I see.
You know what? The best thing you can do is take a look at rpg_scenes.js and take a look at how window refreshing is handled there.
Hm, i understand. Maybe is too complicated to do, and i was expecting some easy/simple fix. I'll look into it, and thank you very much for your attention and answering me ! 🙂
I will reply again just to help anyone googling land here and prevent grave digging.

i just add
Window_StatusDummy.prototype.update = function() {
Window_Base.prototype.update.call(this);
this.drawDummyStatus();
};
The fix is always simple when it comes to already defined functions. However, studying the code always helps, which is why I sent you to study the code and figure out the solution.

Original thread: https://forums.rpgmakerweb.com/threads/solved-window-status-attributes-refresh.92184/