hastag
hastag <player> <string>
Whether a player carries a given marker tag.
Tags are named markers attached to a player by tag and removed
by untag. hastag reports whether a particular marker is
present. Tags live on players only; the first argument must be a
player, so guard with isplayer when the creature might be
an NPC.
Arguments
<player>— a player creature. A creature that is not a player produces a run-time error, so checkisplayerfirst.<string>— the marker name to look for.
Returns
A bool — true if the player has the named tag, false otherwise.
Examples
after command (say) {
require [isplayer $actor]
if [not [hastag $actor "greeted"]] {
do "say Welcome! I'll remember you."
tag $actor "greeted"
}
}
The require guard ensures the actor is a player
before hastag runs; the greeting then fires once, after which the
greeted tag suppresses it on later visits.
See also
tag— add a marker tag to a player.untag— remove a marker tag.isplayer— guardhastagagainst NPC arguments.- Persistent state — tags versus stored values.