Ace Item Menu - Hide Unused Categories

Hey. My game uses Yanfly's Ace Item Menu.

Is there a way to modify it so item/weapon/armor categories for which the player currently has no items/weapons/armors simply do not appear? This would:
1)Unclatter the menu.
2)Prevent spoilers, because some item categories are exclusive to certain actors in the game for balancing reasons, and having the category names appear when the player searches through their gathered items, pretty much spoils that they will join the party at some point.

Thanks in advance for any help.
This will hide the items (except key items) unless the item, weapon or armour has a notetag for the type of item it is.
Ruby:
class Window_ItemCommand < Window_Command
  def make_command_list
    for command in YEA::ITEM::COMMANDS
      case command
      #--- Default Commands ---
      when :item
        add_command(Vocab::item, :item) unless $game_party.items.empty?
      when :weapon
        add_command(Vocab::weapon, :weapon) unless $game_party.weapons.empty?
      when :armor
        add_command(Vocab::armor, :armor) unless $game_party.armors.empty?
      when :key_item
        add_command(Vocab::key_item, :key_item)
      #--- Imported ---
      when :gogototori
        next unless $imported["KRX-AlchemicSynthesis"]
        process_custom_command(command)
      #--- Custom Commands ---
      else
        process_custom_command(command)
      end
    end
  end
end
class Window_ItemType < Window_Command
  def make_command_list
    return if @type.nil?
    #---
    case @type
    when :item
      commands = YEA::ITEM::ITEM_TYPES
    when :weapon
      commands = YEA::ITEM::WEAPON_TYPES
    else
      commands = YEA::ITEM::ARMOUR_TYPES
    end
    #---
    for command in commands
      case command[0]
      #---
      when :types
        case @type
        when :weapon
          for i in 1...$data_system.weapon_types.size
            name = $data_system.weapon_types[i]
            add_command(name, :w_type, true, i)
          end
        else
          for i in 1...$data_system.armor_types.size
            name = $data_system.armor_types[i]
            add_command(name, :a_type, true, i)
          end
        end
      #---
      when :slots
        if $imported["YEA-AceEquipEngine"]
          maximum = 1
          for key in YEA::EQUIP::TYPES
            maximum = [maximum, key[0]].max
          end
        else
          maximum = 4
        end
        for i in 1..maximum
          name = Vocab::etype(i)
          add_command(name, :e_type, true, i) if name != ""
        end
      #---
      else
        case @type
        when :weapon
          for i in 0..$game_party.weapons.size - 1
            if $game_party.weapons[i].note.include?(command[1])
              add_command(command[1], command[0], true, @type)
            end
          end
        when :armor
          for i in 0..$game_party.armors.size - 1
            if $game_party.armors[i].note.include?(command[1])
              add_command(command[1], command[0], true, @type)
            end
          end
        when :item
          for i in 0..$game_party.items.size - 1
            if $game_party.items[i].note.include?(command[1])
              add_command(command[1], command[0], true, @type)
            end
          end
        end
        add_command(command[1], command[0], true, @type) if command[0] == :all
      end
    end
  end
end
This will hide the items (except key items) unless the item, weapon or armour has a notetag for the type of item it is.
Ruby:
class Window_ItemCommand < Window_Command
  def make_command_list
    for command in YEA::ITEM::COMMANDS
      case command
      #--- Default Commands ---
      when :item
        add_command(Vocab::item, :item) unless $game_party.items.empty?
      when :weapon
        add_command(Vocab::weapon, :weapon) unless $game_party.weapons.empty?
      when :armor
        add_command(Vocab::armor, :armor) unless $game_party.armors.empty?
      when :key_item
        add_command(Vocab::key_item, :key_item)
      #--- Imported ---
      when :gogototori
        next unless $imported["KRX-AlchemicSynthesis"]
        process_custom_command(command)
      #--- Custom Commands ---
      else
        process_custom_command(command)
      end
    end
  end
end
class Window_ItemType < Window_Command
  def make_command_list
    return if @type.nil?
    #---
    case @type
    when :item
      commands = YEA::ITEM::ITEM_TYPES
    when :weapon
      commands = YEA::ITEM::WEAPON_TYPES
    else
      commands = YEA::ITEM::ARMOUR_TYPES
    end
    #---
    for command in commands
      case command[0]
      #---
      when :types
        case @type
        when :weapon
          for i in 1...$data_system.weapon_types.size
            name = $data_system.weapon_types[i]
            add_command(name, :w_type, true, i)
          end
        else
          for i in 1...$data_system.armor_types.size
            name = $data_system.armor_types[i]
            add_command(name, :a_type, true, i)
          end
        end
      #---
      when :slots
        if $imported["YEA-AceEquipEngine"]
          maximum = 1
          for key in YEA::EQUIP::TYPES
            maximum = [maximum, key[0]].max
          end
        else
          maximum = 4
        end
        for i in 1..maximum
          name = Vocab::etype(i)
          add_command(name, :e_type, true, i) if name != ""
        end
      #---
      else
        case @type
        when :weapon
          for i in 0..$game_party.weapons.size - 1
            if $game_party.weapons[i].note.include?(command[1])
              add_command(command[1], command[0], true, @type)
            end
          end
        when :armor
          for i in 0..$game_party.armors.size - 1
            if $game_party.armors[i].note.include?(command[1])
              add_command(command[1], command[0], true, @type)
            end
          end
        when :item
          for i in 0..$game_party.items.size - 1
            if $game_party.items[i].note.include?(command[1])
              add_command(command[1], command[0], true, @type)
            end
          end
        end
        add_command(command[1], command[0], true, @type) if command[0] == :all
      end
    end
  end
end
Hm... Then I'd have to tag all weapons and armors (since normally they don't need to be tagged, unlike items. How would I tag them? <category: Axe> for example?
That's how the ace menu script works. You set the category for the item in the script and set the note tag for the item.
If it was only a few item categories then it could be make to specify those in particular, but the way it is now is much more comprehensive and adaptable.
That's how the ace menu script works. You set the category for the item in the script and set the note tag for the item.
If it was only a few item categories then it could be make to specify those in particular, but the way it is now is much more comprehensive and adaptable.
Ok, I'll try it, thanks.
Edit: Doesn't work. It basically hides the Inventory->Armor menu completely, but only until the player gets a single tagged item that belongs in there. Then it reveals all categories, like before.
Well the first part window_itemcommand, is what hides the armour category initially but as soon as you get an armour it shows that command.
The second part window_itemtype, hides the seperate groups that are in the ace item menu script.

You say it shows them all? You must have something else overwriting this addon. My test is with ace item menu script and this addon, nothing else.
I started with nothing and all categories were hidden. I added a weapon with no tags and it show the weapon menu and put it under all category. I added a weapon with a tag short swords and that category showed up not any others.
Well the first part window_itemcommand, is what hides the armour category initially but as soon as you get an armour it shows that command.
The second part window_itemtype, hides the seperate groups that are in the ace item menu script.

You say it shows them all? You must have something else overwriting this addon. My test is with ace item menu script and this addon, nothing else.
I started with nothing and all categories were hidden. I added a weapon with no tags and it show the weapon menu and put it under all category. I added a weapon with a tag short swords and that category showed up not any others.
Hm... Is there maybe a command to simply not show certain categories? The character-specific gear categories can be hidden.
We should find the incompatibility.
Spoiler: pictures
1633115739044.png
1633115752906.png

1633115839032.png
1633115851005.png

1633115934300.png
Do you have this addon at the bottom of your script list?
If you mean the one you provided me above, I tried having it both directly below the original script and at the bottom of the list. Same result. As soon as you get even one item (tagged or not it doesn't matter), every category pops open.

Edit: Not sure it's a compability issue btw. Just made an entirely new project and only copied the original script & your addon, and I have the same issue.
Edit 2: Also it makes no difference whether the item is tagged or not.
It's not a week for me to be writing code it seems. Everything works for me but no one else.
@Gravemaster Every test I do works for me. Have you modified the ace item script?

*update
@Gravemaster I pulled down your demo again. For whatever reason for you the code works in a different manner. Plus it also did not help that you have the categories for the ace item menu in a way that makes it not usable.
1634246174870.png

Ruby:
    WEAPON_TYPES =[
    # [  :symbol,   "Display"],
      [     :all,       "All"], # Shows all weapons.
      [:category,  "WPNTYPES"], # Lists all of the individual weapon types.
1634246232017.png


This is how the item categories is supposed to be set up. to whatever item types you are using.
1634246305079.png


This version worked for your game.
Ruby:
class Window_ItemCommand < Window_Command
  def make_command_list
    for command in YEA::ITEM::COMMANDS
      case command
      #--- Default Commands ---
      when :item
        add_command(Vocab::item, :item) unless $game_party.items.empty?
      when :weapon
        add_command(Vocab::weapon, :weapon) unless $game_party.weapons.empty?
      when :armor
        add_command(Vocab::armor, :armor) unless $game_party.armors.empty?
      when :key_item
        add_command(Vocab::key_item, :key_item)
      #--- Imported ---
      when :gogototori
        next unless $imported["KRX-AlchemicSynthesis"]
        process_custom_command(command)
      #--- Custom Commands ---
      else
        process_custom_command(command)
      end
    end
  end
end
class Window_ItemType < Window_Command
  def make_command_list
    return if @type.nil?
    #---
    case @type
    when :item
      commands = YEA::ITEM::ITEM_TYPES
    when :weapon
      commands = YEA::ITEM::WEAPON_TYPES
    else
      commands = YEA::ITEM::ARMOUR_TYPES
    end
    #---
    for command in commands
      case command[0]
      #---
      when :types
        case @type
        when :weapon
          for i in 0..$game_party.weapons.size - 1
            if $game_party.weapons[i].note.include?(command[1])
              add_command(command[1], command[0], true, @type)
            end
          end
        when :armor
          for i in 0..$game_party.armors.size - 1
            if $game_party.armors[i].note.include?(command[1])
              add_command(command[1], command[0], true, @type)
            end
          end
        when :item
          for i in 0..$game_party.items.size - 1
            if $game_party.items[i].note.include?(command[1])
              add_command(command[1], command[0], true, @type)
            end
          end
        end
      #---
      when :slots
        if $imported["YEA-AceEquipEngine"]
          maximum = 1
          for key in YEA::EQUIP::TYPES
            maximum = [maximum, key[0]].max
          end
        else
          maximum = 4
        end
        for i in 1..maximum
          name = Vocab::etype(i)
          add_command(name, :e_type, true, i) if name != ""
        end
      #---
      else
        case @type
        when :weapon
          for i in 0..$game_party.weapons.size - 1
            if $game_party.weapons[i].note.include?(command[1])
              add_command(command[1], command[0], true, @type)
            end
          end
        when :armor
          for i in 0..$game_party.armors.size - 1
            if $game_party.armors[i].note.include?(command[1])
              add_command(command[1], command[0], true, @type)
            end
          end
        when :item
          for i in 0..$game_party.items.size - 1
            if $game_party.items[i].note.include?(command[1])
              add_command(command[1], command[0], true, @type)
            end
          end
        end
        add_command(command[1], command[0], true, @type) if command[0] == :all
      end
    end
  end
end

Original thread: https://forums.rpgmakerweb.com/threads/ace-item-menu-hide-unused-categories.140898/