Equipment¶
Methods to interact with the Equipment tab.
type ERSEquipmentSlot¶
ERSEquipmentSlot = (
HEAD, SECONDARY_AMMO, CAPE, NECK, AMMO, WEAPON,
BODY, SHIELD, LEGS, HANDS, FEET, RING
);
Enumerator of the equipment slots.
type TRSEquipment¶
TRSEquipment = record(TRSInterface)
Slots: TBoxArray;
end;
Main equipment type reponsible for handling it.
Equipment.GetSlotBoxes¶
function TRSEquipment.GetSlotBoxes(): TBoxArray;
Returns the boxes of slots in the equipment tab.
Example:
Debug(Equipment.GetSlotBoxes());
Equipment.IsOpen¶
function TRSEquipment.IsOpen(): Boolean;
Returns true/false whether the equipment tab is open or not.
Example:
WriteLn Equipment.IsOpen();
Equipment.Open¶
function TRSEquipment.Open(): Boolean;
Attempts to open the equipment tab. Returns true if we succeed.
Example:
WriteLn Equipment.Open();
Equipment.FindItem¶
function TRSEquipment.FindItem(item: TRSItem; 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 TRSEquipment.FindItems(Items: TRSItemArray; 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 TRSEquipment.ContainsItem(item: TRSItem): Boolean;
function TRSEquipment.ContainsAny(items: TRSItemArray): Boolean;
function TRSEquipment.ContainsAll(items: TRSItemArray): Boolean;
Same as Equipment.FindItem without the bounds.
Example:
WriteLn Equipment.ContainsItem('Abyssal whip');
Equipment.ContainsAny¶
function TRSEquipment.ContainsAny(items: TRSItemArray): 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 TRSEquipment.ContainsAll(items: TRSItemArray): 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 TRSEquipment.DiscoverAllEx(): array of TRSItemArray;
function TRSEquipment.DiscoverAll(): TRSItemArray;
Returns all possible items found in the equipment.
The extended version returns an array of TRSItemArray
while the other returns
a flat TRSItemArray
.
Example:
if Equipment.Open() then
WriteLn Equipment.DiscoverAll();
Equipment.Discover¶
function TRSEquipment.Discover(slot: ERSEquipmentSlot): TRSItemArray;
function TRSInventory.Discover(slot: Int32): TRSItemArray;
Discovers what item is on the specified equipment slot
.
Example:
if Equipment.Open() then
WriteLn Equipment.Discover(0);
Equipment.HoverItem¶
function TRSEquipment.HoverItem(item: TRSItem): 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 TRSEquipment.ClickItem(item: TRSItem; 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 TRSEquipment.CountItemStack(item: TRSItem): 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.IsSlotUsed¶
function TRSEquipment.IsSlotUsed(b: TBox): Boolean;
function TRSEquipment.IsSlotUsed(slot: ERSEquipmentSlot): Boolean; overload;
Returns true if a slot is occupied.
Example:
WriteLn Equipment.IsSlotUsed(ERSEquipmentSlot.WEAPON);
Equipment.CountGear¶
function TRSEquipment.CountGear(): Int32;
Returns the number of equipped items.
Example:
WriteLn Equipment.CountGear();
var Equipment¶
Global Equipment variable.