Skip to content

Classes ​

Player ​

This class references the current player whilst in-game and is accessible on the global scope as the player variable.

Example ​

ts
while (true) {
  if (player.hits < 50) {
    player.say('I need healing!');
  }
  sleep(500);
}

Extends ​

Properties ​

_tag ​
ts
_tag: 'Mobile';
Inherited from ​

Mobile._tag


backpack ​
ts
backpack: undefined | Item;

coldResistance ​
ts
coldResistance: number;

damageIncrease ​
ts
damageIncrease: number;

damageMax ​
ts
damageMax: number;

damageMin ​
ts
damageMin: number;

defenseChanceIncrease ​
ts
defenseChanceIncrease: number;

dexterity ​
ts
dexterity: number;

direction ​
ts
direction: number;

Gets the direction of the entity as a number, if it has one. Returns 0 if the client does not know (e.g. item.maxHits) or the entity is no longer on screen.

Compare using the Directions enum.

Example ​
ts
const entity = client.findObject(0x991);
if (entity) {
  if (entity.direction === Directions.North) {
    console.log(`${entity.name} is facing North`);
  } else {
    console.log(Directions[entity.direction]); // Prints the directions name, e.g. East
  }
}
Inherited from ​

Mobile.direction


energyResistance ​
ts
energyResistance: number;

equippedItems ​
ts
equippedItems: object;

The currently equipped items of the mobile (humanoid/players)

MemberType
armsItem
beardItem
braceletItem
cloakItem
earringsItem
faceItem
glovesItem
hairItem
helmetItem
legsItem
mountItem
necklaceItem
oneHandedItem
pantsItem
ringItem
robeItem
shirtItem
shoesItem
skirtItem
talismanItem
torsoItem
tunicItem
twoHandedItem
waistItem
Inherited from ​

Mobile.equippedItems


fasterCastRecovery ​
ts
fasterCastRecovery: number;

fasterCasting ​
ts
fasterCasting: number;

fireResistance ​
ts
fireResistance: number;

followers ​
ts
followers: number;

gold ​
ts
gold: number;

graphic ​
ts
graphic: number;

Gets the graphic id of the entity. Returns 0 if entity is no longer on screen.

Example ​
ts
console.log(player.graphic); // e.g. 400
Inherited from ​

Mobile.graphic


hitChanceIncrease ​
ts
hitChanceIncrease: number;

hits ​
ts
hits: number;

Gets the hits of the entity. Returns 0 if the client does not know (e.g. item.hits) or the entity is no longer on screen.

Example ​
ts
const entity = client.findObject(0x991);
if (entity) {
  console.log(entity.hits);
}
Inherited from ​

Mobile.hits


hue ​
ts
hue: number;

Gets the hue/color of the entity. Returns 0 if entity is no longer on screen.

Example ​
ts
const entity = client.findObject(player.equippedItems.robe);
if (entity) {
  console.log(entity.name);
}
Inherited from ​

Mobile.hue


inWarMode ​
ts
inWarMode: boolean;

Whether the mobile is currently in War Mode (humanoid)

Inherited from ​

Mobile.inWarMode


intelligence ​
ts
intelligence: number;

isDead ​
ts
isDead: boolean;

Whether the mobile is dead

Inherited from ​

Mobile.isDead


isFemale ​
ts
isFemale: boolean;

Whether the mobile is female, or otherwise male.

Inherited from ​

Mobile.isFemale


isHidden ​
ts
isHidden: boolean;
Inherited from ​

Mobile.isHidden


isParalyzed ​
ts
isParalyzed: boolean;

Whether the mobile is currently paralyzed.

Inherited from ​

Mobile.isParalyzed


isPoisoned ​
ts
isPoisoned: boolean;

Whether the mobile is poisoned (green hued)

Inherited from ​

Mobile.isPoisoned


isYellowHits ​
ts
isYellowHits: boolean;

Whether the mobiles status is yellow (i.e. Invulnerable)

Inherited from ​

Mobile.isYellowHits


lowerManaCost ​
ts
lowerManaCost: number;

lowerReagentCost ​
ts
lowerReagentCost: number;

luck ​
ts
luck: number;

mana ​
ts
mana: number;

The mobiles current mana. For the player it returns the real value, for other mobiles it is a scale of 1 to 100

Inherited from ​

Mobile.mana


map ​
ts
map: number;

maxColdResistence ​
ts
maxColdResistence: number;

maxDefenseChanceIncrease ​
ts
maxDefenseChanceIncrease: number;

maxEnergyResistence ​
ts
maxEnergyResistence: number;

maxFireResistence ​
ts
maxFireResistence: number;

maxFollowers ​
ts
maxFollowers: number;

maxHits ​
ts
maxHits: number;

Gets the maxHits of the entity. Returns 0 if the client does not know (e.g. item.maxHits) or the entity is no longer on screen.

Example ​
ts
const entity = client.findObject(0x991);
if (entity) {
  console.log(entity.maxHits);
}
Inherited from ​

Mobile.maxHits


maxMana ​
ts
maxMana: number;

The mobiles maximum mana. For the player it returns the real value, for other mobiles it is a scale of 1 to 100

Inherited from ​

Mobile.maxMana


maxPhysicResistence ​
ts
maxPhysicResistence: number;

maxPoisonResistence ​
ts
maxPoisonResistence: number;

maxStamina ​
ts
maxStamina: number;

The mobiles maximum stamina. For the player it returns the real value, for other mobiles it is a scale of 1 to 100

Inherited from ​

Mobile.maxStamina


name ​
ts
name: string;

Gets the name of the entity. Returns an empty string if not known to the client yet.

Example ​
ts
const entity = client.findObject(player.equippedItems.robe);
if (entity) {
  console.log(entity.name);
}
Inherited from ​

Mobile.name


notoriety ​
ts
notoriety: Notorieties;

The mobiles Notoriety, i.e. Innocent, Gray, etc.

Inherited from ​

Mobile.notoriety


physicalResistance ​
ts
physicalResistance: number;

poisonResistance ​
ts
poisonResistance: number;

primaryAbility ​
ts
primaryAbility: Abilities;

secondaryAbility ​
ts
secondaryAbility: Abilities;

serial ​
ts
serial: number;
Overrides ​

Mobile.serial


spellDamageIncrease ​
ts
spellDamageIncrease: number;

stamina ​
ts
stamina: number;

The mobiles current stamina. For the player it returns the real value, for other mobiles it is a scale of 1 to 100

Inherited from ​

Mobile.stamina


statsCap ​
ts
statsCap: number;

strength ​
ts
strength: number;

swingSpeedIncrease ​
ts
swingSpeedIncrease: number;

tithingPoints ​
ts
tithingPoints: number;

weight ​
ts
weight: number;

weightMax ​
ts
weightMax: number;

x ​
ts
x: number;

Gets the current X coordinate of the entity. Returns 0 if entity is no longer on screen.

Example ​
ts
const entity = client.findObject(player); // Replace with any other entity serial
console.log(entity.x);
Inherited from ​

Mobile.x


y ​
ts
y: number;

Gets the current Y coordinate of the entity. Returns 0 if entity is no longer on screen.

Example ​
ts
const entity = client.findObject(player);
console.log(entity.y);
Inherited from ​

Mobile.y


z ​
ts
z: number;

Gets the current Z coordinate of the entity. Returns 0 if entity is no longer on screen.

Example ​
ts
const entity = client.findObject(player);
console.log(entity.z);
Inherited from ​

Mobile.z

Methods ​

attack() ​
ts
attack(serial: SerialOrEntity): void

Attacks a mobile

Parameters ​
ParameterType
serialSerialOrEntity
Example ​
ts
player.attack(target.lastSerial);

bow() ​
ts
bow(): void

Triggers the Bow emote

Example ​
ts
player.bow();

cast() ​
ts
cast(spell: any): void

Casts a spell

Parameters ​
ParameterType
spellany
Example ​
ts
player.cast(Spells.Agility);
target.wait();
target.entity(player);

castTo() ​
ts
castTo(
   spell: any,
   serial: SerialOrEntity,
   timeout?: number): void

Casts a spell and automatically targets the given serial on the next target

Parameters ​
ParameterType
spellany
serialSerialOrEntity
timeout?number
Example ​
ts
player.castTo(Spells.Heal, player);

click() ​
ts
click(serial: SerialOrEntity): void

Simulates clicking an object

Parameters ​
ParameterType
serialSerialOrEntity
Example ​
ts
player.click(player);

dressKr() ​
ts
dressKr(items: (number | Item)[]): void
Parameters ​
ParameterType
items(number | Item)[]

equip() ​
ts
equip(serial: SerialOrEntity): void

Attempts to equip an item if possible

Parameters ​
ParameterType
serialSerialOrEntity
Example ​
ts
const axe = client.findType(0x0f49); // Axe graphic ID
player.equip(axe);

fly() ​
ts
fly(): void

Attempt to fly... if you can.

Example ​
ts
player.fly();

getAllSkills() ​
ts
getAllSkills(): undefined | object[]

Gets an array of all the skill values

Returns ​

undefined | object[]

Example ​
ts
const skills = player.getSkills();
console.log(skills[0].value); // Print Alchemy skill value

getSkill() ​
ts
getSkill(skill: Skills): undefined | object

Gets an object containing the values of a skill. The actual value of the skill is represented as an integer value with no decimal. e.g. 74.6 would be 746

Parameters ​
ParameterType
skillSkills
Returns ​

undefined | object

Example ​
ts
const anatomySkill = player.getSkill(Skills.Anatomy).value;

hasBuffDebuff() ​
ts
hasBuffDebuff(buffID: BuffDebuffs): boolean
Parameters ​
ParameterType
buffIDBuffDebuffs
Returns ​

boolean


land() ​
ts
land(): void

Turn off flying and land

Example ​
ts
player.land();

moveItem() ​
ts
moveItem(
   serial: SerialOrEntity,
   container: SerialOrEntity,
   x?: number,
   y?: number,
   z?: number,
   amount?: number): number

Attempts to move an object between containers

Parameters ​
ParameterType
serialSerialOrEntity
containerSerialOrEntity
x?number
y?number
z?number
amount?number
Returns ​

number

Example ​
ts
if (player.equippedItems.robe) {
  player.moveItem(player.equippedItems.robe, player.backpack);
}

moveItemOnGroundOffset() ​
ts
moveItemOnGroundOffset(
   serial: SerialOrEntity,
   x?: number,
   y?: number,
   z?: number,
   amount?: number): number

Attempts to move an object around on the ground using an offset

Parameters ​
ParameterType
serialSerialOrEntity
x?number
y?number
z?number
amount?number
Returns ​

number

Example ​
ts
const targetInfo = target.queryTarget();
if (targetInfo) {
  player.moveItemOnGroundOffset(targetInfo, 1, 0, 0); // Move item to the east
}

moveType() ​
ts
moveType(
   graphic: number,
   src: SerialOrEntity,
   dest: SerialOrEntity,
   x?: number,
   y?: number,
   z?: number,
   hue?: number,
   amount?: number,
   range?: number): number

Attempts to move an object of a certain type between containers

Parameters ​
ParameterType
graphicnumber
srcSerialOrEntity
destSerialOrEntity
x?number
y?number
z?number
hue?number
amount?number
range?number
Returns ​

number

Example ​
ts
player.moveType(0x0f52, player.backpack, bag);

moveTypeOnGroundOffset() ​
ts
moveTypeOnGroundOffset(
   graphic: number,
   src: SerialOrEntity,
   x?: number,
   y?: number,
   z?: number,
   hue?: number,
   amount?: number,
   range?: number): number

Attempts to move an object of a certain type onto the ground

Parameters ​
ParameterType
graphicnumber
srcSerialOrEntity
x?number
y?number
z?number
hue?number
amount?number
range?number
Returns ​

number

Example ​
ts
player.moveType(0x0f52, player.backpack); // Move item to the east

openDoor() ​
ts
openDoor(): void

Uses any door directly in-front of where the player is facing

Example ​
ts
player.openDoor();

run() ​
ts
run(direction: Directions): boolean

Run/turn a single step in a direction

Parameters ​
ParameterType
directionDirections
Returns ​

boolean

True if character can run

Example ​
ts
player.run(Directions.South);

salute() ​
ts
salute(): void

Triggers the Salute emote

Example ​
ts
player.salute();

say() ​
ts
say(message: string, hue?: number): void

Sends a chat message as your player, with an optional hue for the message.

Parameters ​
ParameterType
messagestring
hue?number
Example ​
ts
player.say('Hello there!');

setAbility() ​
ts
setAbility(primary: boolean, active: boolean): void

Toggle ability on/off

Parameters ​
ParameterType
primaryboolean
activeboolean
Example ​
ts
player.setAbility(true, false); // Turn primary ability off
player.setAbility(false, true); // Turn secondary ability on

setSkillLock() ​
ts
setSkillLock(skill: Skills, lock: SkillLock): void

Set the status of a skill lock

Parameters ​
ParameterType
skillSkills
lockSkillLock
Example ​
ts
player.setSkillLock(Skills.Anatomy, SkillLock.Down);

toggleFlying() ​
ts
toggleFlying(): void

Toggles flying, provided you are a Gargoyle.

Example ​
ts
player.toggleFlying();

toggleWarMode() ​
ts
toggleWarMode(): void

Toggle War Mode

Example ​
ts
player.toggleWarMode();

undressKr() ​
ts
undressKr(layers: Layers[]): void
Parameters ​
ParameterType
layersLayers[]

use() ​
ts
use(serial: SerialOrEntity): void

Attempts to use an object if possible

Parameters ​
ParameterType
serialSerialOrEntity
Example ​
ts
const dagger = client.findType(0x0f52); // Dagger graphic ID
player.use(dagger);

useItemInHand() ​
ts
useItemInHand(): void

Uses the item currently in your left-hand first, otherwise it will try the right.

Example ​
ts
player.useItemInHand();

useLastObject() ​
ts
useLastObject(): void

Uses the last object you double-clicked

Example ​
ts
player.useLastObject();

useSkill() ​
ts
useSkill(
   skill: any,
   target?: SerialOrEntity,
   timeout?: number): void

Uses a skill

Parameters ​
ParameterType
skillany
target?SerialOrEntity
timeout?number
Example ​
ts
player.useSkill(Skills.Meditation);

@example Use skill and target yourself

```ts
player.useSkill(Skills.Anatomy);

useType() ​
ts
useType(
   graphic: number,
   hue?: number,
   sourceSerial?: SerialOrEntity,
   range?: number): boolean

Attempts to use an object of a certain type

Parameters ​
ParameterType
graphicnumber
hue?number
sourceSerial?SerialOrEntity
range?number
Returns ​

boolean

Example ​
ts
const myFriend = 0x217ded;
player.useType(0xe21); // Bandage type
target.wait(5000);
target.entity(myFriend);

useVirtue() ​
ts
useVirtue(
   virtue: any,
   target?: SerialOrEntity,
   timeout?: number): void

Uses a virtue

Parameters ​
ParameterType
virtueany
target?SerialOrEntity
timeout?number
Example ​
ts
player.useVirtue(Virtues.Honor);

@example Use virtue and target yourself

```ts
player.useVirtue(Virtues.Honor);

waitForBuffDebuff() ​
ts
waitForBuffDebuff(buffId: BuffDebuffs, timeoutMs?: number): null | boolean
Parameters ​
ParameterType
buffIdBuffDebuffs
timeoutMs?number
Returns ​

null | boolean


walk() ​
ts
walk(direction: Directions): boolean

Walk/turn a single step in a direction

Parameters ​
ParameterType
directionDirections
Returns ​

boolean

True if character can walk

Example ​
ts
player.walk(Directions.North);