isplayer

isplayer <creature>

Whether a creature is a player rather than an NPC (a mobile).

Arguments

Returns

A booltrue if the creature is a player, false if it is an NPC (or the argument does not resolve to a live creature).

Examples

after command (say) {
  do "say isplayer self=[isplayer $self]."
}

The owner $self is a mobile, not a player, so [isplayer $self] is false.

after command (say) {
  require [isplayer $actor]
  do "tell $actor Welcome, traveller."
}

This guard lets the handler greet only player actors; when the actor is an NPC the script advances to the next matching handler (see require). It is also the right guard before player-only built-ins such as hastag, tag, and award.

See also