Equipment

Methods to interact with the Equipment tab.


type EEquipmentSlot

EEquipmentSlot = (
  HEAD, SECONDARY_AMMO, CAPE, NECK, AMMO, WEAPON,
  BODY, SHIELD, LEGS, HANDS, FEET, RING
);

Enumerator of the equipment slots.


type EEquipmentButton

EEquipmentButton = (STATS_BTN, PRICES, DEATH, FOLLOWER);

Enumerator of the equipment buttons.


type TEquipment

TEquipment = type TItemInterface;

Main equipment type reponsible for handling it.


Equipment.GetSlotBoxes

function TEquipment.GetSlotBoxes(): TBoxArray;

Returns the boxes of slots in the equipment tab.

Example:

Debug(Equipment.GetSlotBoxes());

Equipment.GetSlotBox

function TEquipment.GetSlotBox(slot: EEquipmentSlot): TBox;
function TEquipment.GetSlotBox(slot: Int32): TBox;

Returns the TBox of the specified equipment slot.

Example:

WriteLn(Equipment.GetSlotBox(EEquipmentSlot.HEAD));
WriteLn(Equipment.GetSlotBox(0)); // HEAD slot

Equipment.IsOpen

function TEquipment.IsOpen(): Boolean;

Returns true/false whether the equipment tab is open or not.

Example:

WriteLn Equipment.IsOpen();

Equipment.Open

function TEquipment.Open(): Boolean;

Attempts to open the equipment tab. Returns true if we succeed.

Example:

WriteLn Equipment.Open();

Equipment.GetButtons

function TEquipment.GetButtons(): TGameButtonArray;

Returns a TGameButtonArray of the bottom equipment buttons.

Example:

Debug(Equipment.GetButtons());

Equipment.GetButton

function TEquipment.GetButton(button: EEquipmentButton): TGameButton;

Returns a TGameButton of the specified equipment button.

Example:

Debug([Equipment.GetButton(EEquipmentButton.PRICES)]);

Equipment.FindItem

function TEquipment.FindItem(item: TItem; out bounds: TBox): Boolean;

Returns true if we find the item specified in the equipment tab. bounds will return a TBox of the item bounds.

Example:

if Equipment.FindItem('Abyssal whip', bounds) then
  Debug(bounds);

Equipment.FindItems

function TEquipment.FindItems(Items: TItemArray; out Slots: TIntegerArray): Boolean;

Attempts to find the items passed in Items. The function returns true if any item is found and the slots of the found items will be returned in Slots.

Example:

var
  slots: TIntegerArray;
begin
  if Equipment.FindItems(['Slayer helmet', 'Dragon scimitar'], slots) then
    WriteLn('The slots that have Slayer helmet and Dragon scimitar are: ', slots);
end;

Equipment.Contains

function TEquipment.ContainsItem(item: TItem): Boolean;
function TEquipment.ContainsAny(items: TItemArray): Boolean;
function TEquipment.ContainsAll(items: TItemArray): Boolean;

Same as Equipment.FindItem without the bounds.

Example:

WriteLn Equipment.ContainsItem('Abyssal whip');

Equipment.ContainsAny

function TEquipment.ContainsAny(items: TItemArray): Boolean;

Returns true if any item on the items parameter is found on the equipment tab.

Example:

WriteLn Equipment.ContainsAny(['Abyssal whip', 'Dragon dagger']);

Equipment.ContainsAll

function TEquipment.ContainsAll(items: TItemArray): Boolean;

Returns true if all items on the items parameter are found on the equipment tab.

Example:

WriteLn Equipment.ContainsAll(['Abyssal whip', 'Dragon dagger']);

Equipment.DiscoverAll

function TEquipment.DiscoverAllEx(): array of TItemArray;
function TEquipment.DiscoverAll(): TItemArray;

Returns all possible items found in the equipment. The extended version returns an array of TItemArray while the other returns a flat TItemArray.

Example:

if Equipment.Open() then
  WriteLn Equipment.DiscoverAll();

Equipment.Discover

function TEquipment.Discover(slot: EEquipmentSlot): TItemArray;
function TInventory.Discover(slot: Int32): TItemArray;

Discovers what item is on the specified equipment slot.

Example:

if Equipment.Open() then
  WriteLn Equipment.Discover(0);

Equipment.HoverItem

function TEquipment.HoverItem(item: TItem): Boolean;

Attempts to hover an item, returns false if the item is not on the equipment tab.

Example:

WriteLn Equipment.HoverItem('Abyssal whip');

Equipment.ClickItem

function TEquipment.ClickItem(item: TItem; option: String = ''): Boolean;

Attempts to click an item, if an option is specified, that option will be selected if it exists via right clicking if it’s not the first action.

Returns false if the item is not found or the option specified doesn’t exist.

Example:

WriteLn Equipment.ClickItem('Abyssal whip');

Equipment.CountItemStack

function TEquipment.CountItemStack(item: TItem): Int32;

Attempts to count an item stack. Realistically, it’s only useful for ammo or any other few stackable items that can be equipped.

Returns -1 if the item is not found or if there’s no stack number to read.

Example:

WriteLn Equipment.CountItemStack('Broad bolts');

Equipment.ClickSlot

function TEquipment.ClickSlot(slot: Int32; option: String = ''): Boolean;
function TEquipment.ClickSlot(slot: EEquipmentSlot; option: String = ''): Boolean; overload;

Moves the mouse and clicks on the specified equipment slot. Slot is an Integer corresponding to the equipment slot indices. If option is empty, the slot is left clicked. Otherwise, a right click is performed and the specified option is selected from the context menu.

Example:

if Equipment.ClickSlot(EEquipmentSlot.WEAPON) then
  WriteLn('Left clicked the weapon slot');

if Equipment.ClickSlot(EEquipmentSlot.RING, 'Rub') then
  WriteLn('Right clicked and selected "Rub" on the ring slot');

Equipment.IsSlotUsed

function TEquipment.IsSlotUsed(b: TBox): Boolean;
function TEquipment.IsSlotUsed(slot: EEquipmentSlot): Boolean; overload;

Returns true if a slot is occupied.

Example:

WriteLn Equipment.IsSlotUsed(EEquipmentSlot.WEAPON);

Equipment.CountGear

function TEquipment.CountGear(): Int32;

Returns the number of equipped items.

Example:

WriteLn Equipment.CountGear();

var Equipment

Global Equipment variable.