Existence Tag Expression
Context: HL Kit … Kit Reference … Tag Expression Types
The role of the Existence tag expression is very similar to the Secondary tag expression. It is always used in conjunction with a portal that adds a pick to a container, such as a dynamic table or chooser. Instead of being processed as part of the portal, the tag expression is attached to the pick. When the pick is selected and added to the container, the Existence tag expression is also added to the new pick. At that point, the tag expression becomes part of the pick for the rest of the pick's existence.
Once added to the pick, the Existence tag expression governs whether the pick continues to exist within its container (hence the name). The Existence tag expression must be satisfied in order for the pick to continue its existence and avoid being automatically deleted. If the tag expression stops being satisfied, the pick is immediately deleted from the container, just as if the user had deleted it. This is a much more severe action than the Secondary tag expression, which simply causes the pick to go non-live. However, it is sometimes the better choice.
The Existence tag expression is always applied against the container to which the pick was added. The tag expression is compared against all of the tags possessed by the container, which includes the effects of all dynamically assigned and deleted tags. The Existence tag expression is invoked every evaluation cycle at the timing specified. This means that the pick can fail the tag expression at any time, depending on changes that occur with the container. Once that occurs, the pick is automatically deleted in its entirety.
It's also valid to omit the timing for an Existence tag expression and use default timing. The default timing is Setup/5000. However, you can setup whatever you want as the default timing for the Existence tag expression within the definition file.
As an example, consider the wizard class within the d20 System. When a level of wizard is added, the user can add all sorts of spells to the wizard, both within the spell book and as memorized spells. Once those spells are added, they are independent of the wizard class level pick. This means that, if the user deletes the wizard level, all of the spells will still exist on the character. You could use a Secondary tag expression for this, but there would be no way for the user to delete these spells if the wizard class tab disappears. It would also be a real nuisance for the user to delete all of the spells, one at a time. If you use an Existence tag expression on the spells, then they will all be instantly discarded when the user delete the last wizard class level pick.