Classes
Player
This class references the current player whilst in-game and is accessible on the global scope as the player variable.
Example
while (true) {
if (player.hits < 50) {
player.say('I need healing!');
}
sleep(500);
}Extends
Properties
direction
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
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
equippedItems
equippedItems: object;The currently equipped items of the mobile (humanoid/players)
| Member | Type |
|---|---|
arms | Item |
beard | Item |
bracelet | Item |
cloak | Item |
earrings | Item |
face | Item |
gloves | Item |
hair | Item |
helmet | Item |
legs | Item |
mount | Item |
necklace | Item |
oneHanded | Item |
pants | Item |
ring | Item |
robe | Item |
shirt | Item |
shoes | Item |
skirt | Item |
talisman | Item |
torso | Item |
tunic | Item |
twoHanded | Item |
waist | Item |
Inherited from
graphic
graphic: number;Gets the graphic id of the entity. Returns 0 if entity is no longer on screen.
Example
console.log(player.graphic); // e.g. 400Inherited from
hits
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
const entity = client.findObject(0x991);
if (entity) {
console.log(entity.hits);
}Inherited from
hue
hue: number;Gets the hue/color of the entity. Returns 0 if entity is no longer on screen.
Example
const entity = client.findObject(player.equippedItems.robe);
if (entity) {
console.log(entity.name);
}Inherited from
inWarMode
inWarMode: boolean;Whether the mobile is currently in War Mode (humanoid)
Inherited from
isYellowHits
isYellowHits: boolean;Whether the mobiles status is yellow (i.e. Invulnerable)
Inherited from
mana
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
maxHits
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
const entity = client.findObject(0x991);
if (entity) {
console.log(entity.maxHits);
}Inherited from
maxMana
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
maxStamina
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
name
name: string;Gets the name of the entity. Returns an empty string if not known to the client yet.
Example
const entity = client.findObject(player.equippedItems.robe);
if (entity) {
console.log(entity.name);
}Inherited from
notoriety
notoriety: Notorieties;The mobiles Notoriety, i.e. Innocent, Gray, etc.
Inherited from
stamina
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
x
x: number;Gets the current X coordinate of the entity. Returns 0 if entity is no longer on screen.
Example
const entity = client.findObject(player); // Replace with any other entity serial
console.log(entity.x);Inherited from
y
y: number;Gets the current Y coordinate of the entity. Returns 0 if entity is no longer on screen.
Example
const entity = client.findObject(player);
console.log(entity.y);Inherited from
z
z: number;Gets the current Z coordinate of the entity. Returns 0 if entity is no longer on screen.
Example
const entity = client.findObject(player);
console.log(entity.z);Inherited from
Methods
attack()
attack(serial: SerialOrEntity): voidAttacks a mobile
Parameters
| Parameter | Type |
|---|---|
serial | SerialOrEntity |
Example
player.attack(target.lastSerial);cast()
cast(spell: any): voidCasts a spell
Parameters
| Parameter | Type |
|---|---|
spell | any |
Example
player.cast(Spells.Agility);
target.wait();
target.entity(player);castTo()
castTo(
spell: any,
serial: SerialOrEntity,
timeout?: number): voidCasts a spell and automatically targets the given serial on the next target
Parameters
| Parameter | Type |
|---|---|
spell | any |
serial | SerialOrEntity |
timeout? | number |
Example
player.castTo(Spells.Heal, player);click()
click(serial: SerialOrEntity): voidSimulates clicking an object
Parameters
| Parameter | Type |
|---|---|
serial | SerialOrEntity |
Example
player.click(player);equip()
equip(serial: SerialOrEntity): voidAttempts to equip an item if possible
Parameters
| Parameter | Type |
|---|---|
serial | SerialOrEntity |
Example
const axe = client.findType(0x0f49); // Axe graphic ID
player.equip(axe);getAllSkills()
getAllSkills(): undefined | object[]Gets an array of all the skill values
Returns
undefined | object[]
Example
const skills = player.getSkills();
console.log(skills[0].value); // Print Alchemy skill valuegetSkill()
getSkill(skill: Skills): undefined | objectGets 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
| Parameter | Type |
|---|---|
skill | Skills |
Returns
undefined | object
Example
const anatomySkill = player.getSkill(Skills.Anatomy).value;hasBuffDebuff()
hasBuffDebuff(buffID: BuffDebuffs): booleanParameters
| Parameter | Type |
|---|---|
buffID | BuffDebuffs |
Returns
boolean
moveItem()
moveItem(
serial: SerialOrEntity,
container: SerialOrEntity,
x?: number,
y?: number,
z?: number,
amount?: number): numberAttempts to move an object between containers
Parameters
| Parameter | Type |
|---|---|
serial | SerialOrEntity |
container | SerialOrEntity |
x? | number |
y? | number |
z? | number |
amount? | number |
Returns
number
Example
if (player.equippedItems.robe) {
player.moveItem(player.equippedItems.robe, player.backpack);
}moveItemOnGroundOffset()
moveItemOnGroundOffset(
serial: SerialOrEntity,
x?: number,
y?: number,
z?: number,
amount?: number): numberAttempts to move an object around on the ground using an offset
Parameters
| Parameter | Type |
|---|---|
serial | SerialOrEntity |
x? | number |
y? | number |
z? | number |
amount? | number |
Returns
number
Example
const targetInfo = target.queryTarget();
if (targetInfo) {
player.moveItemOnGroundOffset(targetInfo, 1, 0, 0); // Move item to the east
}moveType()
moveType(
graphic: number,
src: SerialOrEntity,
dest: SerialOrEntity,
x?: number,
y?: number,
z?: number,
hue?: number,
amount?: number,
range?: number): numberAttempts to move an object of a certain type between containers
Parameters
| Parameter | Type |
|---|---|
graphic | number |
src | SerialOrEntity |
dest | SerialOrEntity |
x? | number |
y? | number |
z? | number |
hue? | number |
amount? | number |
range? | number |
Returns
number
Example
player.moveType(0x0f52, player.backpack, bag);moveTypeOnGroundOffset()
moveTypeOnGroundOffset(
graphic: number,
src: SerialOrEntity,
x?: number,
y?: number,
z?: number,
hue?: number,
amount?: number,
range?: number): numberAttempts to move an object of a certain type onto the ground
Parameters
| Parameter | Type |
|---|---|
graphic | number |
src | SerialOrEntity |
x? | number |
y? | number |
z? | number |
hue? | number |
amount? | number |
range? | number |
Returns
number
Example
player.moveType(0x0f52, player.backpack); // Move item to the eastopenDoor()
openDoor(): voidUses any door directly in-front of where the player is facing
Example
player.openDoor();run()
run(direction: Directions): booleanRun/turn a single step in a direction
Parameters
| Parameter | Type |
|---|---|
direction | Directions |
Returns
boolean
True if character can run
Example
player.run(Directions.South);say()
say(message: string, hue?: number): voidSends a chat message as your player, with an optional hue for the message.
Parameters
| Parameter | Type |
|---|---|
message | string |
hue? | number |
Example
player.say('Hello there!');setAbility()
setAbility(primary: boolean, active: boolean): voidToggle ability on/off
Parameters
| Parameter | Type |
|---|---|
primary | boolean |
active | boolean |
Example
player.setAbility(true, false); // Turn primary ability off
player.setAbility(false, true); // Turn secondary ability onsetSkillLock()
setSkillLock(skill: Skills, lock: SkillLock): voidSet the status of a skill lock
Parameters
| Parameter | Type |
|---|---|
skill | Skills |
lock | SkillLock |
Example
player.setSkillLock(Skills.Anatomy, SkillLock.Down);toggleFlying()
toggleFlying(): voidToggles flying, provided you are a Gargoyle.
Example
player.toggleFlying();use()
use(serial: SerialOrEntity): voidAttempts to use an object if possible
Parameters
| Parameter | Type |
|---|---|
serial | SerialOrEntity |
Example
const dagger = client.findType(0x0f52); // Dagger graphic ID
player.use(dagger);useItemInHand()
useItemInHand(): voidUses the item currently in your left-hand first, otherwise it will try the right.
Example
player.useItemInHand();useLastObject()
useLastObject(): voidUses the last object you double-clicked
Example
player.useLastObject();useSkill()
useSkill(
skill: any,
target?: SerialOrEntity,
timeout?: number): voidUses a skill
Parameters
| Parameter | Type |
|---|---|
skill | any |
target? | SerialOrEntity |
timeout? | number |
Example
player.useSkill(Skills.Meditation);
@example Use skill and target yourself
```ts
player.useSkill(Skills.Anatomy);useType()
useType(
graphic: number,
hue?: number,
sourceSerial?: SerialOrEntity,
range?: number): booleanAttempts to use an object of a certain type
Parameters
| Parameter | Type |
|---|---|
graphic | number |
hue? | number |
sourceSerial? | SerialOrEntity |
range? | number |
Returns
boolean
Example
const myFriend = 0x217ded;
player.useType(0xe21); // Bandage type
target.wait(5000);
target.entity(myFriend);useVirtue()
useVirtue(
virtue: any,
target?: SerialOrEntity,
timeout?: number): voidUses a virtue
Parameters
| Parameter | Type |
|---|---|
virtue | any |
target? | SerialOrEntity |
timeout? | number |
Example
player.useVirtue(Virtues.Honor);
@example Use virtue and target yourself
```ts
player.useVirtue(Virtues.Honor);waitForBuffDebuff()
waitForBuffDebuff(buffId: BuffDebuffs, timeoutMs?: number): null | booleanParameters
| Parameter | Type |
|---|---|
buffId | BuffDebuffs |
timeoutMs? | number |
Returns
null | boolean
