Player

Extends
Actor
Methods
11
Fields
None

Getting one

client:getLocalPlayer()
client:getHintArrowPlayer()
scene:players():nearest()

Methods

MethodReturnsDescription
getId()numberThe player's index.
getPlayerComposition()PlayerComposition?The player's appearance (worn equipment, colours, gender), as it is now; nil before one is decoded.
getTeam()numberThe team of the player's cape, 0 for none.
isFriendsChatMember()booleanWhether the player is in the local player's friends chat.
isFriend()booleanWhether the player is on the local player's friends list.
isClanMember()booleanWhether the player is in the local player's clan.
getOverheadIcon()HeadIcon?The protection prayer over the player's head, nil for none.
getSkullIcon()numberThe skull over the player's head (SkullIcon), -1 for none.
setSkullIcon(number)()Set the skull over the player's head.
interact(string)booleanThe player option named option ("Trade with", "Follow", "Attack"; any case, colour tags ignored) on this player. The option is matched wh…
target()booleanUse what this plugin selected (player:inventory():select(id), player:magic():select(spell)) on this player. Once per selection, and onl…

Returned by

MethodReturnsDescription
Client.getHintArrowPlayerPlayer?The player a player hint arrow points at; nil otherwise.
Client.getLocalPlayerPlayer?The local player, or nil before the client has one.
Client.getPlayers{Player}The players the client's player info lists.
MenuEntry.getPlayerPlayer?The player the entry targets (a player option, a use on a player, a CLIENT_PLAYER entry) by index getIdentifier(); for WALK, the hove…
PlayerChanged.getPlayerPlayerThe player; never nil. From a legacy (differ) delivery read after the player left the map, the handle it had, with its last-known values.
PlayerDespawned.getPlayerPlayerThe player, readable for the length of the event; never nil. From a legacy (differ) delivery, made after it left the map, the handle it h…
PlayerQuery.collect{ Player }Every survivor, nearest first. Consumes the query.
PlayerQuery.nearestPlayer?The nearest survivor. Consumes the query.
PlayerSet.byIndexPlayer?The player at index, or nil.
PlayerSpawned.getPlayerPlayerThe player; never nil. From a legacy (differ) delivery read after the player left the map, the handle it had, with its last-known values.
WorldPvp.threats{ kind: "safe" | "active" | "unknown", reason: PvpUnknownReason?, combatRange: { min: number, max: number }?, unreadableCandidates: number?, players: { Player }? }Who can attack the local player right now.

Method details

getTeam

getTeam: (Player) -> number

The team of the player's cape, 0 for none.

isFriend

isFriend: (Player) -> boolean

Whether the player is on the local player's friends list.

isClanMember

isClanMember: (Player) -> boolean

Whether the player is in the local player's clan.

getSkullIcon

getSkullIcon: (Player) -> number

The skull over the player's head (SkullIcon), -1 for none.

interact

interact: (Player, string) -> boolean

The player option named option ("Trade with", "Follow", "Attack"; any case, colour tags ignored) on this player. The option is matched when the click fires, against the options the client shows then (which op is "Trade with" varies), and nothing is clicked when none matches. false when the player is gone, or it is in another world view. Raises for an empty option.

target

target: (Player) -> boolean

Use what this plugin selected (player:inventory():select(id), player:magic():select(spell)) on this player. Once per selection, and only after a selection of this plugin's that admits a player (a spell that takes NPCs only does not), as inventory:target is for an item. inventory:useOnPlayer(itemId, player) and magic:castOnPlayer(spell, player) are the select and the use in one call. false when it has no such selection, or the player is gone or in another world view.