Check for item type/category

I've been searching around all morning, but I cannot find the answer to this question:

How do I check to see if an item is of a given Type/category in a script?

Note: I'm using Yanfly's Item Menu Categories.

Thank you!
But what do you need this for? Can you explain?
I'm developing a system where the player can give items to npcs to gain favor. NPCs have certain item types they like, wheth5er that's materials--- such as anything made of gold--- or item categories--- such as luxury items or junk items or hats or food items etc...

I have lots of items with crossover types and want to make a simple script for checking as opposed to many multiple conditional statements for each npc

I want to know how to get the category of an item to check against it.
As I thought, that's why I asked about it. Here's a very helpful script to create this: http://rmrk.net/index.php?topic=50448.0
Thank you for sharing! This will actually prove useful, but I'm not sure if it can do what I need in this case, and here's why:

The player is meant to uncover what the NPC likes from clues in the dialogue (or trial and error). Therefore, they must be able to "gift" any item they posses. So they should be able to select from all their items. The plugin you've shared is more a way to ONLY let the player select from the correct items, if I've read it correctly.

What I need is a way to determine whether the item chosen fits given criteria, possibly as defined by Yanfly's categories. Or is there another way to give Items certain qualities/categories that I can reference?

I realize I could create a conditional tree checking for every single item that fits the criteria. The issue here is the criteria are meant to be randomly generated each playthrough. That is, the NPC is going to like a randomly selected criteria. So it would be much more efficient to let the player select an item, and simply check if it is an item from a category that is equivalent to the category of items the NPC has been set to like.

E.g. NPC likes "golden" category. PC gives ItemX. If ItemX category = "golden" SUCCESS!

Hopefully that makes sense... Maybe I'm approaching this wrong? Both plugins discussed have ways of assigning items certain categories, surely there must be a way to reference this information?
You wouldn't need to check for every single item if you set your types to something like "NPC1 Gold" and "NPC1 Silver" you'd only need to check for the item types that apply to that NPC. You'd have 1 type for every tier per NPC and items can have multiple categories.

Original thread: https://forums.rpgmakerweb.com/threads/check-for-item-type-category.118420/