MV How do I delete this line? (Yanfly plugins)

So in my game's inventory page, every item has a the "Use" option on the 1st line. My question is, how do I remove this if it's grayed out (i.e. the item has no use function). I'd like to dig into the JS and add in a conditional so that the "Use" command doesn't appear if it's grayed out. I believe it would have to do w/ YEP_ItemCore, otherwise maybe YEP_EquipCore?

Screenshot:
1603779187382.png


So I found this snippet in YEP_ItemCore.js...but what should I put for the conditional?
JavaScript:
Window_ItemActionCommand.prototype.makeCommandList = function() {
    if (!this._item) return;
    this.addUseCommand();
    this.addCustomCommandsA();
    this.addCustomCommandsB();
    this.addCustomCommandsC();
    this.addCustomCommandsD();
    this.addCustomCommandsE();
    this.addCustomCommandsF();
    this.addCancelCommand();
};
JavaScript:
 //this.addUseCommand();
You can try commenting out lines with //
You don't have to delete anything. And can easily reinstate it if it doesn't have the desired effect.

Edit:
Ah, but I imagine that'll remove "use" for all items, not just weapons.
There's probably a property category to distinguish key items from other items. So you could add an if statement like
JavaScript:
if (!this._weapon){this.addUseCommand()};
which, I'm just pretending that ._weapon is a property, would add "use" to everything except weapons types.
And if you have specific items that you may want "use" you could made an exception list based on IDs.
There's probably a property category to distinguish key items from other items. So you could add an if statement like
My thoughts exactly, I just don't know the correct terminology to make the conditional work. However, it would be better to check if the item in question has a "use" function to begin w/ than to check if the item is an armor or weapon.
Seems like checking this.isUsableItem() would work: https://kinoar.github.io/rmmv-doc-web/classes/game_item.html
I believe there is a method
JavaScript:
if (DataManager.isWeapon(this) = false) {add the thing}
But (this) might require a more specific property.
this._item perhaps. I'm just taking shots in the dark.
Seems like checking this.isUsableItem() would work: https://kinoar.github.io/rmmv-doc-web/classes/game_item.html
Lol doh, it didn't work. It seemed promising too...
1603782665974.png

JavaScript:
Window_ItemActionCommand.prototype.makeCommandList = function() {
    if (!this._item) return;
    if (this.isUsableItem()) {
        this.addUseCommand();
    }
    this.addCustomCommandsA();
    this.addCustomCommandsB();
    this.addCustomCommandsC();
    this.addCustomCommandsD();
    this.addCustomCommandsE();
    this.addCustomCommandsF();
    this.addCancelCommand();
};
Edit: I've also tried this._item.isUsableItem() to no avail...
Edit2: Eureka! The solution was this:
JavaScript:
    if (this._item.isUsableItem) {
        this.addUseCommand();
    }
Lol doh, it didn't work. It seemed promising too...
View attachment 165536
JavaScript:
Window_ItemActionCommand.prototype.makeCommandList = function() {
    if (!this._item) return;
    if (this.isUsableItem()) {
        this.addUseCommand();
    }
    this.addCustomCommandsA();
    this.addCustomCommandsB();
    this.addCustomCommandsC();
    this.addCustomCommandsD();
    this.addCustomCommandsE();
    this.addCustomCommandsF();
    this.addCancelCommand();
};
Edit: I've also tried this._item.isUsableItem() to no avail...
My bad, "this" has a different context in this case because it's being used in a window, so the proper code would be this._item.isUsableItem(). However, looking into the isUsableItem function, it returns true if the object is a skill or an item, which doesn't really narrow down addUseCommand() by much.

Instead, you can try "$gameParty.canUse(this._item)" and hopefully it'll keep it down to consumables/usable skills.
Edit2: Eureka! The solution was this:
JavaScript:
if (this._item.isUsableItem) {
this.addUseCommand();
}
Interesting how removing the parenthesis after "isUsableItem" fixed it lol. GJ!
Actually, my previous post was flawed. The correct way to implement it is this:
JavaScript:
Window_ItemActionCommand.prototype.makeCommandList = function() {
    if (!this._item) return;
    if ($gameParty.canUse(this._item)) {
        this.addUseCommand();
    }
    this.addCustomCommandsA();
    this.addCustomCommandsB();
    this.addCustomCommandsC();
    this.addCustomCommandsD();
    this.addCustomCommandsE();
    this.addCustomCommandsF();
    this.addCancelCommand();
};
It works perfectly!

Original thread: https://forums.rpgmakerweb.com/threads/how-do-i-delete-this-line-yanfly-plugins.129205/