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;
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. 400
Inherited 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
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
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
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): void
Attacks a mobile
Parameters
Parameter | Type |
---|---|
serial | SerialOrEntity |
Example
player.attack(target.lastSerial);
cast()
cast(spell: string | Spells): void
Casts a spell
Parameters
Parameter | Type |
---|---|
spell | string | Spells |
Example
player.cast(Spells.Agility);
target.wait();
target.entity(player);
castTo()
castTo(
spell:
| Spells
| "Clumsy"
| "CreateFood"
| "Feeblemind"
| "Heal"
| "MagicArrow"
| "NightSight"
| "ReactiveArmor"
| "Weaken"
| "Agility"
| "Cunning"
| "Cure"
| "Harm"
| "MagicTrap"
| "RemoveTrap"
| "Protection"
| "Strength"
| "Bless"
| "Fireball"
| "MagicLock"
| "Poison"
| "Telekinesis"
| "Teleport"
| "Unlock"
| "WallOfStone"
| "ArchCure"
| "ArchProtection"
| "Curse"
| "FireField"
| "GreaterHeal"
| "Lightning"
| "ManaDrain"
| "Recall"
| "BladeSpirits"
| "DispelField"
| "Incognito"
| "MagicReflect"
| "MindBlast"
| "Paralyze"
| "PoisonField"
| "SummonCreature"
| "Dispel"
| "EnergyBolt"
| "Explosion"
| "Invisibility"
| "Mark"
| "MassCurse"
| "ParalyzeField"
| "Reveal"
| "ChainLightning"
| "EnergyField"
| "FlameStrike"
| "GateTravel"
| "ManaVampire"
| "MassDispel"
| "MeteorSwarm"
| "Polymorph"
| "Earthquake"
| "EnergyVortex"
| "Resurrection"
| "AirElemental"
| "SummonDaemon"
| "EarthElemental"
| "FireElemental"
| "WaterElemental"
| "AnimateDead"
| "BloodOath"
| "CorpseSkin"
| "CurseWeapon"
| "EvilOmen"
| "HorrificBeast"
| "LichForm"
| "MindRot"
| "PainSpike"
| "PoisonStrike"
| "Strangle"
| "SummonFamiliar"
| "VampiricEmbrace"
| "VengefulSpirit"
| "Wither"
| "WraithForm"
| "Exorcism"
| "CleanseByFire"
| "CloseWounds"
| "ConsecrateWeapon"
| "DispelEvil"
| "DivineFury"
| "EnemyOfOne"
| "HolyLight"
| "NobleSacrifice"
| "RemoveCurse"
| "SacredJourney"
| "HonorableExecution"
| "Confidence"
| "Evasion"
| "CounterAttack"
| "LightningStrike"
| "MomentumStrike"
| "FocusAttack"
| "DeathStrike"
| "AnimalForm"
| "KiAttack"
| "SurpriseAttack"
| "Backstab"
| "Shadowjump"
| "MirrorImage"
| "ArcaneCircle"
| "GiftOfRenewal"
| "ImmolatingWeapon"
| "Attunement"
| "Thunderstorm"
| "NaturesFury"
| "SummonFey"
| "SummonFiend"
| "ReaperForm"
| "Wildfire"
| "EssenceOfWind"
| "DryadAllure"
| "EtherealVoyage"
| "WordOfDeath"
| "GiftOfLife"
| "ArcaneEmpowerment"
| "NetherBolt"
| "HealingStone"
| "PurgeMagic"
| "Enchant"
| "Sleep"
| "EagleStrike"
| "AnimatedWeapon"
| "StoneForm"
| "SpellTrigger"
| "MassSleep"
| "CleansingWinds"
| "Bombard"
| "SpellPlague"
| "HailStorm"
| "NetherCyclone"
| "RisingColossus"
| "Inspire"
| "Invigorate"
| "Resilience"
| "Perseverance"
| "Tribulation"
| "Despair"
| "DeathRay"
| "EtherealBurst"
| "NetherBlast"
| "MysticWeapon"
| "CommandUndead"
| "Conduit"
| "ManaShield"
| "SummonReaper"
| "EnchantedSummoning"
| "AnticipateHit"
| "Warcry"
| "Intuition"
| "Rejuvenate"
| "HolyFist"
| "Shadow"
| "WhiteTigerForm"
| "FlamingShot"
| "PlayingTheOdds"
| "Thrust"
| "Pierce"
| "Stagger"
| "Toughness"
| "Onslaught"
| "FocusedEye"
| "ElementalFury"
| "CalledShot"
| "WarriorsGifts"
| "ShieldBash"
| "Bodyguard"
| "HeightenSenses"
| "Tolerance"
| "InjectedStrike"
| "Potency"
| "Rampage"
| "FistsOfFury"
| "Knockout"
| "Whispering"
| "CombatTraining"
| "Boarding",
serial: SerialOrEntity,
timeout?: number): void
Casts a spell and automatically targets the given serial on the next target
Parameters
Parameter | Type |
---|---|
spell | | Spells | "Clumsy" | "CreateFood" | "Feeblemind" | "Heal" | "MagicArrow" | "NightSight" | "ReactiveArmor" | "Weaken" | "Agility" | "Cunning" | "Cure" | "Harm" | "MagicTrap" | "RemoveTrap" | "Protection" | "Strength" | "Bless" | "Fireball" | "MagicLock" | "Poison" | "Telekinesis" | "Teleport" | "Unlock" | "WallOfStone" | "ArchCure" | "ArchProtection" | "Curse" | "FireField" | "GreaterHeal" | "Lightning" | "ManaDrain" | "Recall" | "BladeSpirits" | "DispelField" | "Incognito" | "MagicReflect" | "MindBlast" | "Paralyze" | "PoisonField" | "SummonCreature" | "Dispel" | "EnergyBolt" | "Explosion" | "Invisibility" | "Mark" | "MassCurse" | "ParalyzeField" | "Reveal" | "ChainLightning" | "EnergyField" | "FlameStrike" | "GateTravel" | "ManaVampire" | "MassDispel" | "MeteorSwarm" | "Polymorph" | "Earthquake" | "EnergyVortex" | "Resurrection" | "AirElemental" | "SummonDaemon" | "EarthElemental" | "FireElemental" | "WaterElemental" | "AnimateDead" | "BloodOath" | "CorpseSkin" | "CurseWeapon" | "EvilOmen" | "HorrificBeast" | "LichForm" | "MindRot" | "PainSpike" | "PoisonStrike" | "Strangle" | "SummonFamiliar" | "VampiricEmbrace" | "VengefulSpirit" | "Wither" | "WraithForm" | "Exorcism" | "CleanseByFire" | "CloseWounds" | "ConsecrateWeapon" | "DispelEvil" | "DivineFury" | "EnemyOfOne" | "HolyLight" | "NobleSacrifice" | "RemoveCurse" | "SacredJourney" | "HonorableExecution" | "Confidence" | "Evasion" | "CounterAttack" | "LightningStrike" | "MomentumStrike" | "FocusAttack" | "DeathStrike" | "AnimalForm" | "KiAttack" | "SurpriseAttack" | "Backstab" | "Shadowjump" | "MirrorImage" | "ArcaneCircle" | "GiftOfRenewal" | "ImmolatingWeapon" | "Attunement" | "Thunderstorm" | "NaturesFury" | "SummonFey" | "SummonFiend" | "ReaperForm" | "Wildfire" | "EssenceOfWind" | "DryadAllure" | "EtherealVoyage" | "WordOfDeath" | "GiftOfLife" | "ArcaneEmpowerment" | "NetherBolt" | "HealingStone" | "PurgeMagic" | "Enchant" | "Sleep" | "EagleStrike" | "AnimatedWeapon" | "StoneForm" | "SpellTrigger" | "MassSleep" | "CleansingWinds" | "Bombard" | "SpellPlague" | "HailStorm" | "NetherCyclone" | "RisingColossus" | "Inspire" | "Invigorate" | "Resilience" | "Perseverance" | "Tribulation" | "Despair" | "DeathRay" | "EtherealBurst" | "NetherBlast" | "MysticWeapon" | "CommandUndead" | "Conduit" | "ManaShield" | "SummonReaper" | "EnchantedSummoning" | "AnticipateHit" | "Warcry" | "Intuition" | "Rejuvenate" | "HolyFist" | "Shadow" | "WhiteTigerForm" | "FlamingShot" | "PlayingTheOdds" | "Thrust" | "Pierce" | "Stagger" | "Toughness" | "Onslaught" | "FocusedEye" | "ElementalFury" | "CalledShot" | "WarriorsGifts" | "ShieldBash" | "Bodyguard" | "HeightenSenses" | "Tolerance" | "InjectedStrike" | "Potency" | "Rampage" | "FistsOfFury" | "Knockout" | "Whispering" | "CombatTraining" | "Boarding" |
serial | SerialOrEntity |
timeout ? | number |
Example
player.castTo(Spells.Heal, player);
click()
click(serial: SerialOrEntity): void
Simulates clicking an object
Parameters
Parameter | Type |
---|---|
serial | SerialOrEntity |
Example
player.click(player);
equip()
equip(serial: SerialOrEntity): void
Attempts 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 value
getSkill()
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
Parameter | Type |
---|---|
skill | Skills |
Returns
undefined
| object
Example
const anatomySkill = player.getSkill(Skills.Anatomy).value;
hasBuffDebuff()
hasBuffDebuff(buffID: BuffDebuffs): boolean
Parameters
Parameter | Type |
---|---|
buffID | BuffDebuffs |
Returns
boolean
moveItem()
moveItem(
serial: SerialOrEntity,
container: SerialOrEntity,
x?: number,
y?: number,
z?: number,
amount?: number): number
Attempts 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): number
Attempts 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): number
Attempts 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): number
Attempts 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 east
openDoor()
openDoor(): void
Uses any door directly in-front of where the player is facing
Example
player.openDoor();
run()
run(direction: Directions): boolean
Run/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): void
Sends 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): void
Toggle 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 on
setSkillLock()
setSkillLock(skill: Skills, lock: SkillLock): void
Set the status of a skill lock
Parameters
Parameter | Type |
---|---|
skill | Skills |
lock | SkillLock |
Example
player.setSkillLock(Skills.Anatomy, SkillLock.Down);
toggleFlying()
toggleFlying(): void
Toggles flying, provided you are a Gargoyle.
Example
player.toggleFlying();
use()
use(serial: SerialOrEntity): void
Attempts 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(): void
Uses the item currently in your left-hand first, otherwise it will try the right.
Example
player.useItemInHand();
useLastObject()
useLastObject(): void
Uses the last object you double-clicked
Example
player.useLastObject();
useSkill()
useSkill(
skill:
| "RemoveTrap"
| Skills
| "Alchemy"
| "Anatomy"
| "AnimalLore"
| "ItemID"
| "ArmsLore"
| "Parry"
| "Begging"
| "Blacksmith"
| "Fletching"
| "Peacemaking"
| "Camping"
| "Carpentry"
| "Cartography"
| "Cooking"
| "DetectHidden"
| "Discordance"
| "EvalInt"
| "Healing"
| "Fishing"
| "Forensics"
| "Herding"
| "Hiding"
| "Provocation"
| "Inscribe"
| "Lockpicking"
| "Magery"
| "MagicResist"
| "Tactics"
| "Snooping"
| "Musicianship"
| "Poisoning"
| "Archery"
| "SpiritSpeak"
| "Stealing"
| "Tailoring"
| "AnimalTaming"
| "TasteID"
| "Tinkering"
| "Tracking"
| "Veterinary"
| "Swords"
| "Macing"
| "Fencing"
| "Wrestling"
| "Lumberjacking"
| "Mining"
| "Meditation"
| "Stealth"
| "Necromancy"
| "Focus"
| "Chivalry"
| "Bushido"
| "Ninjitsu"
| "Spellweaving"
| "Mysticism"
| "Imbuing"
| "Throwing",
target?: SerialOrEntity,
timeout?: number): void
Uses a skill
Parameters
Parameter | Type |
---|---|
skill | | "RemoveTrap" | Skills | "Alchemy" | "Anatomy" | "AnimalLore" | "ItemID" | "ArmsLore" | "Parry" | "Begging" | "Blacksmith" | "Fletching" | "Peacemaking" | "Camping" | "Carpentry" | "Cartography" | "Cooking" | "DetectHidden" | "Discordance" | "EvalInt" | "Healing" | "Fishing" | "Forensics" | "Herding" | "Hiding" | "Provocation" | "Inscribe" | "Lockpicking" | "Magery" | "MagicResist" | "Tactics" | "Snooping" | "Musicianship" | "Poisoning" | "Archery" | "SpiritSpeak" | "Stealing" | "Tailoring" | "AnimalTaming" | "TasteID" | "Tinkering" | "Tracking" | "Veterinary" | "Swords" | "Macing" | "Fencing" | "Wrestling" | "Lumberjacking" | "Mining" | "Meditation" | "Stealth" | "Necromancy" | "Focus" | "Chivalry" | "Bushido" | "Ninjitsu" | "Spellweaving" | "Mysticism" | "Imbuing" | "Throwing" |
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): boolean
Attempts 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: Virtues | "Honor" | "Sacrifice" | "Valor",
target?: SerialOrEntity,
timeout?: number): void
Uses a virtue
Parameters
Parameter | Type |
---|---|
virtue | Virtues | "Honor" | "Sacrifice" | "Valor" |
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 | boolean
Parameters
Parameter | Type |
---|---|
buffId | BuffDebuffs |
timeoutMs ? | number |
Returns
null
| boolean
walk()
walk(direction: Directions): boolean
Walk/turn a single step in a direction
Parameters
Parameter | Type |
---|---|
direction | Directions |
Returns
boolean
True
if character can walk
Example
player.walk(Directions.North);