What are Tags for?
Tags are a way of keeping track of what events have already happened in your game
Tags are numbered. The first two tags, 0 and 1 are special. The rest, 2 thru 15999 are user-defined. Each tag can be thought of as a switch that is either ON or OFF. (for you programmers, that's an array of booleans) When the game starts all of the tags are OFF.
Various actions in your game can turn tags ON or OFF such as talking to an NPC, or picking up an item. Other things are dependant on tags. You can make an NPC who will only appear if a certain tags is ON. You can make an item that a shop will only sell to you if a particular tag is OFF. You can make a door that leads to one place when a tag is ON, and another if it is OFF
You can assign names to your tags to help you remember what they each mean. For example, if tag 10 is ON while you have at least one potion in your inventory, and OFF when you are out of potions, you can name it "have potions". Or if tag 14 gets turned on after you talk to the King, you can name it "Spoke to King"