Variables, in some way, shape, or form!
If you're counting key items rather than general items--if you needed five specific potions--you can use a variable to count them as you pick them up. (Shameless self-promotion: if you haven't experimented with variables yet, I go step by step on this exact type of "collect # of this item" quest in my eventing tutorial! XD)
I'm not at my dev computer right now so I can't check for sure, but I think you can set a variable = to the number of an item in the inventory. If that's the case, you would set a variable ("Potion Count") equal to that, then add your conditional branch as "If [Variable] "Potion Count" is greater than or equal to 5." If that's the sort of thing you're looking for, check in the Change Variables menu for now--I can take a look tomorrow when I'm at the correct computer!
I don't know if it existed in XP, but all later makers have an option in control variable : game data to count items in inventory.
If that does not exist you'll have to count on picking up
in both cases this is followed by a conditional branch of the variable value.