tag
tag <player> <string>
Add a marker tag to a player.
Tags are named markers attached to a player; the matching predicate
hastag tests for them and untag removes them.
Use them to remember a yes/no fact about a player across visits — whether
they have been greeted, completed a step, been warned, and so on. Adding a
tag that is already present is harmless.
Arguments
<player>— a player creature. Tags live on players only; passing an NPC is a run-time error, so guard withisplayerwhen the creature might be a mob.<string>— the marker name to set.
Returns
null. Like the other action commands, a
successful tag in the handle phase suppresses the event's default
action.
Examples
after command (say) {
require [isplayer $actor]
unless [hastag $actor "greeted"] {
do "say Welcome! I'll remember you."
tag $actor "greeted"
}
}
The require guard keeps the handler from running for
NPCs; the greeting then fires once, and the greeted tag suppresses it on
later visits.
See also
untag— remove a marker tag.hastag— test whether a player has a marker tag.isplayer— guardtagagainst NPC arguments.- Persistent state — tags versus stored values.