MZ Window_EquipItem Modification

So I've been trying to figure something out with this code.

Code:
  if (this._actor) {
        const slotName = this.actorSlotName(this._actor, index);
        const item = this.itemAt(index);
        const slotNameWidth = this.slotNameWidth();
        const rect = this.itemLineRect(index);
        const itemWidth = rect.width - slotNameWidth;
        this.changeTextColor(ColorManager.systemColor());
        this.changePaintOpacity(this.isEnabled(index));
            if (this._equipId == 0) {
            this.drawText(slotName, rect.x, rect.y, slotNameWidth, rect.height);
            } else
                    this.drawItemName(item, rect.x + slotNameWidth, rect.y, itemWidth);
        this.changePaintOpacity(true);
    }
};

I'm trying to get the equipment slot name hidden if something is equipped to that slot. For example, the "Weapon" text would be hidden if a weapon was actually equipped.
this.drawText(slotName, rect.x, rect.y, slotNameWidth, rect.height);
you could try checking if the actor has anything in their first equip slot and then display an empty string or not run the command at all if there was something there
Code:
this.drawText(this._actor.equips()[0] ? "" : slotname, rect.x, rect.y, slotNameWidth, rect.height);
I see that it works. Likewise I could've just removed the slot name code in its entirety as I discovered on my own.

Again, I want it to either display the slotName (the equipment type) or the equipment in the slot.
Hi there!
Maybe this could work:

JavaScript:
    if (this._actor) {
        const slotName = this.actorSlotName(this._actor, index);
        const item = this.itemAt(index);
        const slotNameWidth = this.slotNameWidth();
        const rect = this.itemLineRect(index);
        const itemWidth = rect.width - slotNameWidth;
        this.changeTextColor(ColorManager.systemColor());
        this.changePaintOpacity(this.isEnabled(index));

        if(item){
            this.drawItemName(item, rect.x, rect.y, itemWidth);
        }else{
            this.drawText(slotName, rect.x, rect.y, slotNameWidth, rect.height);
        }

        this.changePaintOpacity(true);
    }

Let me know!
Hi there!
Maybe this could work:

JavaScript:
    if (this._actor) {
        const slotName = this.actorSlotName(this._actor, index);
        const item = this.itemAt(index);
        const slotNameWidth = this.slotNameWidth();
        const rect = this.itemLineRect(index);
        const itemWidth = rect.width - slotNameWidth;
        this.changeTextColor(ColorManager.systemColor());
        this.changePaintOpacity(this.isEnabled(index));

        if(item){
            this.drawItemName(item, rect.x, rect.y, itemWidth);
        }else{
            this.drawText(slotName, rect.x, rect.y, slotNameWidth, rect.height);
        }

        this.changePaintOpacity(true);
    }

Let me know!
You know. That did the trick. Thanks!

Case closed!!

Original thread: https://forums.rpgmakerweb.com/threads/window_equipitem-modification.181279/