MZ [Help] How to manipulate gold window from shop number window?

Hmm anyone have an idea how to manipulate the gold window from the shop number window?

Thinking of showing a color-coded difference in prices.
* Ex1: You have 300G, something costs 50G in buy mode -> Shows 250G in (red) on your gold window
* Ex2: You have 300G, and selling a potion for 50G in sell mode -> Shows 350G in (green) on your gold window

I'm trying to use SceneManager._scene, but the numberWindow never seems to be "active" when calling the gold window refresh
Before I close this, can you share how you solved it?
This might be useful for future users.
Before I close this, can you share how you solved it?
This might be useful for future users.
Oh! Sure! I would like to apologize prematurely since I suck at explaining things, but I'll try.
Alright so the two main important methods to do this (+one new one) are:

JavaScript:
// This will return the gold window to normal
const sceneShop_endNumInput = Scene_Shop.prototype.endNumberInput;
Scene_Shop.prototype.endNumberInput = function() {
    sceneShop_endNumInput.call(this);
    this._goldWindow.refresh();
};

// This will call a separate method that we use to
// control the new color scheme.
const wsn_refresh = Window_ShopNumber.prototype.refresh;
Window_ShopNumber.prototype.refresh = function() {
    wsn_refresh.call(this);
    const goldWindow = SceneManager._scene._goldWindow;
    goldWindow.numWindowRefresh();
};

// The new method to refresh the gold window's changes
Window_Gold.prototype.numWindowRefresh = function() {
    const scene = SceneManager._scene;
    const numWindow = scene._numberWindow;
    const cmdWindow = scene._commandWindow;
    const total = numWindow._price * numWindow.number();
    const unit = this.currencyUnit();
    const rect = this.itemLineRect(0);
    this.contents.clear();
    switch (cmdWindow.currentSymbol()) {
        case "buy": {
            let value = this.value() - total;
            this.processColorChange(10);
            this.drawCurrencyValue(value, unit, rect.x, rect.y, rect.width);
        } break;
        case "sell": {
            let value = this.value() + total;
            this.processColorChange(24);
            this.drawCurrencyValue(value, unit, rect.x, rect.y, rect.width);
        } break;
    }
    this.resetFontSettings();
};

Now there may be better ways to optimize it, but for the moment It Just Works lol.
Note: My code doesn't actually use the drawCurrencyValue() function, so it's untested, I have a different function for its setup. But hopefully this can at least help.

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/help-how-to-manipulate-gold-window-from-shop-number-window.127806/