Player¶
Overview¶
The Player table contains functions which provide data belonging to the currently logged in Player Character.
This data includes:
- Skills Levels & XP
- Run Energy
- Self Player Entity
Examples¶
-- The % of run energy remaining
local runEnergy = Player.GetRunEnergy()
-- The current gameplay level of a Skill (including bonuses and penalties)
local levelAttack = Player.GetLevelGameplay(SkillType.Attack)
-- The XP of a Skill, capped by a Free/Members world check
local cappedXPMagic = Player.GetXPCapped(SkillType.Magic)
Enumerations¶
SkillType¶
An enum for all Skills in the game.
| Name | Value |
|---|---|
| ATTACK | 0 |
| DEFENCE | 1 |
| STRENGTH | 2 |
| HITPOINTS | 3 |
| RANGED | 4 |
| PRAYER | 5 |
| MAGIC | 6 |
| COOKING | 7 |
| WOODCUTTING | 8 |
| FLETCHING | 9 |
| FISHING | 10 |
| FIREMAKING | 11 |
| CRAFTING | 12 |
| SMITHING | 13 |
| MINING | 14 |
| HERBLORE | 15 |
| AGILITY | 16 |
| THIEVING | 17 |
| SLAYER | 18 |
| FARMING | 19 |
| RUNECRAFTING | 20 |
| HUNTER | 21 |
| CONSTRUCTION | 22 |
| SUMMONING | 23 |
| DUNGEONEERING | 24 |
| DIVINATION | 25 |
| INVENTION | 26 |
| ARCHAEOLOGY | 27 |
| NECROMANCY | 28 |
Functions¶
IsAvailable¶
Returns whether a Player Character is logged in and exists in a game world.
| Returns | Description |
|---|---|
| Boolean | Whether Player data is available to access. |
Example
GetTrackingID¶
Returns a unique 64-bit tracking value for the Player Character.
Warning
This value is available to a plugin only if it has requested and been granted the trackingAccess permission.
Info
This value is transmitted to the client on login, and several seconds may pass before it becomes available.
The function will return nil if the value is unavailable, or permission has not been granted.
| Returns | Description |
|---|---|
| Long? | The 64-bit tracking value.Returns nil if unavailable due to login transmission delay, or missing permissions. |
Example
GetLevelGameplay¶
Returns the current level for the given skill. This includes all skill bonuses and penalties.
| Parameter | Type | Description |
|---|---|---|
| skill | SkillType | The skill to return the gameplay level for. |
| Returns | Description |
|---|---|
| Integer | The current gameplay level of the given skill. |
Example
GetLevelCapped¶
Returns the current level for the given skill based on XP. This level is additionally capped by any Free/Member world limits on skill levels.
| Parameter | Type | Description |
|---|---|---|
| skill | SkillType | The skill to return the capped level for. |
| Returns | Description |
|---|---|
| Integer | The current capped level of the given skill. |
Example
GetLevelUncapped¶
Returns the current level for the given skill based on XP.
| Parameter | Type | Description |
|---|---|---|
| skill | SkillType | The skill to return the level for. |
| Returns | Description |
|---|---|
| Integer | The current level of the given skill. |
Example
GetXPCapped¶
Returns the current XP for the given skill. This XP value is additionally capped by any Free/Member world limits on skill levels.
| Parameter | Type | Description |
|---|---|---|
| skill | SkillType | The skill to return the capped XP for. |
| Returns | Description |
|---|---|
| Integer | The current capped XP of the given skill. |
Example
GetXPUncapped¶
Returns the current XP for the given skill.
| Parameter | Type | Description |
|---|---|---|
| skill | SkillType | The skill to return the XP for. |
| Returns | Description |
|---|---|
| Integer | The current XP of the given skill. |
Example
GetRunEnergy¶
Returns the current run energy for the Player Character. This value is a percentage.
| Returns | Description |
|---|---|
| Integer | The current run energy. |
GetWeight¶
Returns the current weight of the Player Character. This value is in kilograms.
| Returns | Description |
|---|---|
| Integer | The current weight. |
GetCombatLevel¶
Returns the current combat level of the Player Character.
| Returns | Description |
|---|---|
| Integer | The current combat level. |
GetEntity¶
Returns the PlayerEntity belonging to the currently logged in Player Character.
| Returns | Description |
|---|---|
| PlayerEntity | A PlayerEntity. |