Skip to content

Classes ​

Client ​

Methods ​

toggleCircleOfTransparency() ​
ts
toggleCircleOfTransparency(): void

Toggles the Circle of Transparency between states

Example ​
ts
client.toggleCircleOfTransparency();

getPing() ​
ts
(): number

Gets the current ping to the server (as seen in the Connection gump)

Returns ​

number

number


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

Display a message in the text chat.

Parameters ​
ParameterType
messagestring
hue?number
Example ​
ts
client.headMsg('A chat in Red', 33);
client.headMsg('A chat in Green', 66);

headMsg() ​
ts
(
   message: string,
   serial: number | SerialObject | GameObject | "world",
   hue?: number): void

Display a message overhead of the target entity.

Parameters ​
ParameterType
messagestring
serialnumber | SerialObject | GameObject | "world"
hue?number
Example ​
ts
client.headMsg('A message in Red', player, 33);
client.headMsg('A message in Green', player, 66);

openPaperdoll() ​
ts
(serial?: number | SerialObject | GameObject | "world"): void

Open the paperdoll for a Mobile.

Parameters ​
ParameterType
serial?number | SerialObject | GameObject | "world"
Example ​
ts
const nearestHuman = client.selectEntity(
  SearchEntityOptions.Any,
  SearchEntityRangeOptions.Nearest,
  SearchEntityTypeOptions.Human,
  false
);

client.openPaperdoll(nearestHuman);

findObject() ​
ts
(
   serial: number | SerialObject | GameObject | "world",
   hue?: null | number,
   sourceSerial?:
  | null
  | number
  | SerialObject
  | GameObject
  | "world",
   amount?: null | number,
   range?: null | number): any

Attempts to check whether a certain object can be found in the game.

Parameters ​
ParameterType
serialnumber | SerialObject | GameObject | "world"
hue?null | number
sourceSerial?| null | number | SerialObject | GameObject | "world"
amount?null | number
range?null | number
Example ​
ts
const runebookSerial = 0x401c37fb;
const runebook = client.findObject(runebookSerial);

if (runebook) {
  player.use(runebook);
} else {
  client.headMsg('Runbook missing!', player.serial);
}

findType() ​
ts
(
   graphic: number,
   hue?: null | number,
   sourceSerial?:
  | null
  | number
  | SerialObject
  | GameObject
  | "world",
   amount?: null | number,
   range?: null | number): any

Attempts to find an object in the world with the specified search parameters, returning it if found.

Note: The range parameter when combined with the source container parameter specifies the depth to search.

Parameters ​
ParameterType
graphicnumber
hue?null | number
sourceSerial?| null | number | SerialObject | GameObject | "world"
amount?null | number
range?null | number
Examples ​
ts
// Print out all the gold in the players backpack, without iterating sub-containers.
const goldType = 0xeed;
ignoreList.clear();

let gold: Item | undefined;
while ((gold = client.findType(goldType, undefined, player.backpack, undefined, 0) as Item)) {
  console.log(gold.name);
  ignoreList.add(gold);
}
ts
//  Use any bandages that can be found
const bandageType = 0xe21;
const bandages = client.findType(bandageType);

if (bandages) {
  player.use(bandages);
  target.waitTargetSelf();
} else {
  client.headMsg('Out of bandages', player.serial);
}

findAllOfType() ​
ts
(
   graphic: number,
   hue?: null | number,
   sourceSerial?:
  | null
  | number
  | SerialObject
  | GameObject
  | "world",
   amount?: null | number,
   range?: null | number): any[]

Attempts to find all objects of a certain type (graphic), returning the matching Items/Mobiles.

Parameters ​
ParameterType
graphicnumber
hue?null | number
sourceSerial?| null | number | SerialObject | GameObject | "world"
amount?null | number
range?null | number
Returns ​

any[]

Example ​
ts
const goldPile = 0xeed;
const piles = client.findAllOfType(goldPile, undefined, 'world');

if (piles.length > 0) {
  client.headMsg(`Found ${piles.length} gold piles on the ground`, player);
} else {
  client.headMsg('No gold piles in range', player);
}

findAllItemsOfType() ​
ts
(
   graphic: number,
   hue?: null | number,
   sourceSerial?:
  | null
  | number
  | SerialObject
  | GameObject
  | "world",
   amount?: null | number,
   range?: null | number): Item[]

Attempts to find all Items of a certain type (graphic).

Parameters ​
ParameterType
graphicnumber
hue?null | number
sourceSerial?| null | number | SerialObject | GameObject | "world"
amount?null | number
range?null | number
Returns ​

Item[]

Example ​
ts
const goldPile = 0xeed;
const piles = client.findAllItemsOfType(goldPile, undefined, 'world');

if (piles.length > 0) {
  const total = piles.reduce((sum, item) => sum + item.amount, 0);
  client.headMsg(`Found ${piles.length} piles, ${total} gold`, player);
} else {
  client.headMsg('No gold piles in range', player);
}

findAllMobilesOfType() ​
ts
(
   graphic: number,
   hue?: null | number,
   sourceSerial?:
  | null
  | number
  | SerialObject
  | GameObject
  | "world",
   amount?: null | number,
   range?: null | number): Mobile[]

Attempts to find all Mobiles of a certain type (graphic).

Parameters ​
ParameterType
graphicnumber
hue?null | number
sourceSerial?| null | number | SerialObject | GameObject | "world"
amount?null | number
range?null | number
Returns ​

Mobile[]

Example ​
ts
const sheepGraphic = 0xcf;
const sheep = client.findAllMobilesOfType(sheepGraphic);

if (sheep.length > 0) {
  client.headMsg(`I count ${sheep.length} sheep`, player);
} else {
  client.headMsg('No sheep here!', player);
}

findItemOnLayer() ​
ts
(serial: number | SerialObject | GameObject | "world", layer: Layers): any

Attempts to find the object at the specified layer, if it exists.

Parameters ​
ParameterType
serialnumber | SerialObject | GameObject | "world"
layerLayers
Example ​
ts
const helm = client.findItemOnLayer(player.serial, Layers.Helmet);

if (helm) {
  client.headMsg(`Removing helm`, player);
  player.moveItem(helm, player.backpack);
} else {
  client.headMsg('Not wearing a helm', player.serial);
}

selectEntity() ​
ts
(
   searchOpt: number,
   searchRangeOpt: number,
   searchTypeOpt: number,
   asFriend: boolean): any

Returns the entity based on the search criteria

Parameters ​
ParameterType
searchOptnumber
searchRangeOptnumber
searchTypeOptnumber
asFriendboolean
Examples ​
ts
client.selectEntity(
  SearchEntityOptions.Enemy | SearchEntityOptions.Gray,
  SearchEntityRangeOptions.Nearest,
  SearchEntityTypeOptions.Any,
  false
);
ts
client.selectEntity(
  SearchEntityOptions.Innocent,
  SearchEntityRangeOptions.Nearest,
  SearchEntityTypeOptions.Human,
  false
);

allNames() ​
ts
(): any

Triggers the All Names macro which shows name overheads for all entities on-screen.

Example ​
ts
client.allNames();

quitGame() ​
ts
(): any

Triggers the Quit Game dialogue

Example ​
ts
client.quitGame();

toggleAlwaysRun() ​
ts
(): any

Toggles whether the player always runs despite the mouse distance from the player mobile.

Example ​
ts
client.toggleAlwaysRun();

closeAllGumps() ​
ts
(): any

Closes all gumps that aren't the Top Bar, Buff bar, or the World view (radar)

Example ​
ts
client.closeAllGumps();

closeCorpses() ​
ts
(): any

Closes all corpses on-screen

Example ​
ts
client.closeCorpses();

closeAllHealthBars() ​
ts
(): any

Closes all healthbars on-screen

Example ​
ts
client.closeAllHealthBars();

closeInactiveHealthBars() ​
ts
(): any

Closes all inactive healthbars (i.e. dead or off-screen entities).

Example ​
ts
client.closeInactiveHealthBars();

zoomReset() ​
ts
(): any

Reset the viewport zoom back to default (1.1)

Example ​
ts
client.zoomReset();

zoomIn() ​
ts
(): any

Zooms in the viewport

Example ​
ts
client.zoomIn();

zoomOut() ​
ts
(): any

Zooms out the viewport

Example ​
ts
client.zoomIn();

toggleChatVisibility() ​
ts
(): any

Toggles the chat visibility, e.g. the bar at the bottom of the game viewport

Example ​
ts
client.zoomIn();

setGrabBag() ​
ts
(): any

Sets the grab bag used by Grid Loot

Example ​
ts
client.zoomIn();

toggleNameOverheads() ​
ts
(): any

Toggles whether entities have name plates

Example ​
ts
client.toggleNameOverheads();

toggleAuras() ​
ts
(): any

Toggles whether mobiles have auras underneath them

Example ​
ts
client.toggleAuras();

getStatic() ​
ts
(graphic: number): undefined | object
Parameters ​
ParameterType
graphicnumber
Returns ​

undefined | object


getTile() ​
ts
(graphic: number): undefined | object
Parameters ​
ParameterType
graphicnumber
Returns ​

undefined | object


getTerrainList() ​
ts
(x: number, y: number): undefined | object[]
Parameters ​
ParameterType
xnumber
ynumber
Returns ​

undefined | object[]


sendBuyRequest() ​
ts
(vendorSerial: any, items: object[]): boolean
Parameters ​
ParameterType
vendorSerialany
itemsobject[]
Returns ​

boolean


sendSellRequest() ​
ts
(vendorSerial: any, items: object[]): boolean
Parameters ​
ParameterType
vendorSerialany
itemsobject[]
Returns ​

boolean


queryItemOPL() ​
ts
(serialOrObject: number | SerialObject | GameObject | "world", timeout?: number): object
Parameters ​
ParameterType
serialOrObjectnumber | SerialObject | GameObject | "world"
timeout?number
Returns ​

object

MemberType
amountnumber
datanull | string
graphicnumber
huenumber
isPartialHueboolean
namestring
propertiesnull | object[]
serialnumber

queryItemSingleClickName() ​
ts
(serialOrObject: number | SerialObject | GameObject | "world", timeout?: number): string
Parameters ​
ParameterType
serialOrObjectnumber | SerialObject | GameObject | "world"
timeout?number
Returns ​

string