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

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