Skip to content

Classes

Target

Properties

last
ts
last: undefined | Item | Mobile;

Object of the last target, i.e. last Item/Mobile


lastObject
ts
lastObject: undefined | Item;

Last object used, i.e. double-clicked by the player


lastObjectSerial
ts
lastObjectSerial: number;

Serial of the last object used, i.e. double-clicked by the player


lastSerial
ts
lastSerial: number;

Serial of the last target


open
ts
open: boolean;

Check if target is open

Methods

cancel()
ts
cancel(): void

Close the target


clearQueue()
ts
clearQueue(): void

Clear target queue


entity()
ts
entity(serial: SerialOrEntity): void

Target a Mobile or an Item with the currently open target

Parameters
ParameterType
serialSerialOrEntity
Example
ts
client.castSpell(Spells.Heal);
target.wait();
target.entity(player);

query()
ts
query(isGround?: boolean): TargetInfo

Creates a target and returns information about the result

Parameters
ParameterType
isGround?boolean
Returns

TargetInfo


repeatLast()
ts
repeatLast(): void

Repeats the last targeting information based on the cursor type, e.g. Entity/Position etc

Examples
ts
client.castSpell(Spells.Heal);
target.wait();
target.repeatLast();
ts
client.castSpell(Spells.Teleport);
target.wait();
target.repeatLast();

self()
ts
self(): void

Target self with the currently open target

Example
ts
client.castSpell(Spells.Heal);
target.wait();
target.self();

terrain()
ts
terrain(
   x: number,
   y: number,
   z: number,
   graphic?: number): void

Target a Tile or Static

When graphic is omitted it will target LAND by default.

Parameters
ParameterType
xnumber
ynumber
znumber
graphic?number
Examples
ts
client.castSpell(Spells.Teleport);
target.wait();
target.terrain(1203, 222, 0);
ts
client.castSpell(Spells.Teleport);
target.wait();
target.terrain(1203, 222, 0, 0x5a2);

terrainRelativeToEntity()
ts
terrainRelativeToEntity(
   entity: SerialOrEntity,
   range: number,
   forward: boolean,
   graphic?: number): void

Target a Tile or Static from a specific Item or Mobile

When graphic is omitted it will target LAND by default.

Parameters
ParameterType
entitySerialOrEntity
rangenumber
forwardboolean
graphic?number
Examples
ts
client.castSpell(Spells.Teleport);
target.wait();
target.terrainRelativeToEntity(mob, 5, true);
ts
client.castSpell(Spells.Teleport);
target.wait();
target.terrainRelativeToEntity(mob, 5, true, 0x5a2);

terrainWithOffset()
ts
terrainWithOffset(
   x: number,
   y: number,
   z: number,
   graphic?: number): void

Target a Tile or Static where { x, y, z } is the distance from the player.

When graphic is omitted it will target LAND by default.

Parameters
ParameterType
xnumber
ynumber
znumber
graphic?number
Examples
ts
client.castSpell(Spells.Teleport);
target.wait();
target.terrainWithOffset(-1, -2, 0);
ts
client.castSpell(Spells.Teleport);
target.wait();
target.terrainWithOffset(-1, -2, 0, 0x5a2);

wait()
ts
wait(timeoutMs?: number): boolean

Wait for the target to open within a specific amount of time.

Parameters
ParameterType
timeoutMs?number
Returns

boolean


waitTargetEntity()
ts
waitTargetEntity(entity: SerialOrEntity, timeoutMs?: number): boolean

Waits for the target to open, and then targets the desired entity

Parameters
ParameterType
entitySerialOrEntity
timeoutMs?number
Returns

boolean


waitTargetSelf()
ts
waitTargetSelf(timeoutMs?: number): boolean

Wait for target with a specific amount of time, when open target self.

Parameters
ParameterType
timeoutMs?number
Returns

boolean

Example
ts
player.useType(0xe21);
target.waitTargetSelf();

waitTargetType()
ts
waitTargetType(
   graphic: number,
   hue?: number,
   timeoutMs?: number): boolean

Wait for target, when open target the first object with a certain graphic/hue

Parameters
ParameterType
graphicnumber
hue?number
timeoutMs?number
Returns

boolean

Example
ts
player.useType(0xf9d);
target.waitTargetType(0x1078);