[VX Ace] Tsukihime's Tag Manager: Search entire inventory for a tag?

Hello! Sorry to post another thread so soon... hopefully it'll be a quick solution. I'm using Tsukihime's Tag Manager, and, as always, many many other scripts that aren't relevant. My problem is simple. I'd like a script command to search the entire inventory to check if any items possess a particular tag. I've been searching for such a command, but I cannot find one. I attempted to brute-force it by putting together two commands to get:

Ruby:
$data_items.tags.include?("testtag")

However, this did not work, as tags is apparently not a method of $data_items, but something else. Is that how that works? I think that's how that works.

Anyway, if such a command is possible to make, can someone let me know? Thank you very much, and have a nice day. 🙂
You are close. Normally there would not be a tags for the program, but this script adds it in.
What you are doing wrong is specifying what item to look at.
You can't say $data_items and have it look at everything.
You will need to do an each statement, which can be coded in a few ways.
Basically you say
Ruby:
itemtagged = false
$data_items.each do |itm|
next if itm == nil
next if itm.tags == nil
if itm.tags.include?("test")
itemtagged = true # or item or item number whatever you want to do.
end
end
Then it runs through all items one by one and checks for the condition.
So, unfortunately, I need this to fit in a conditional branch box... This doesn't fit of course, so how should I work around this limitation? The idea is that you, using Galv's Use Item on Event script, choose an item to use on the event in question, and it needs a certain tag present to proceed. Without this, it would need 25 separate conditional branches to check for each possible item manually...

Edit: I also need this for the exit to the room, which will stop you if you possess any objects from the puzzle.
So using the example code above you can pass the true condition to a switch.
Using that you can simple check the switch when leaving to stop the player.
For the using the correct item, Galv's script does this itself.
Are you doing a condition branch script check with key?( :category,item_id)
That is where you can specify item, key_item, weapon or armour and the id.
That will check if that one specific item was selected.
No, I have a variable that gets equaled to the item being used, then that gets checked. Wasn't aware of the key?() check.
For the puzzle itself I just went with the 25 conditional route, as I had to do that anyway so the game knows which item was being used. I just broke it up into 5 sections, based on category. Then I need to do that check 5 times based on the spot being chosen, with a grand total of 150 conditional checks just for the input...

Original thread: https://forums.rpgmakerweb.com/threads/vx-ace-tsukihimes-tag-manager-search-entire-inventory-for-a-tag.144347/