# Equipment Methods to interact with the Equipment tab. - - - (ERSEquipmentSlot)= ## type ERSEquipmentSlot ```pascal ERSEquipmentSlot = ( HEAD, SECONDARY_AMMO, CAPE, NECK, AMMO, WEAPON, BODY, SHIELD, LEGS, HANDS, FEET, RING ); ``` Enumerator of the equipment slots. - - - (ERSEquipmentButton)= ## type ERSEquipmentButton ```pascal ERSEquipmentButton = (STATS, PRICES, DEATH, FOLLOWER); ``` Enumerator of the equipment buttons. - - - (TRSEquipment)= ## type TRSEquipment ```pascal TRSEquipment = record(TRSInterface) Slots: TBoxArray; end; ``` Main equipment type reponsible for handling it. - - - ## Equipment.GetSlotBoxes ```pascal function TRSEquipment.GetSlotBoxes(): TBoxArray; ``` Returns the boxes of slots in the equipment tab. Example: ```pascal Debug(Equipment.GetSlotBoxes()); ``` - - - ## Equipment.IsOpen ```pascal function TRSEquipment.IsOpen(): Boolean; ``` Returns true/false whether the equipment tab is open or not. Example: ```pascal WriteLn Equipment.IsOpen(); ``` - - - ## Equipment.Open ```pascal function TRSEquipment.Open(): Boolean; ``` Attempts to open the equipment tab. Returns true if we succeed. Example: ```pascal WriteLn Equipment.Open(); ``` - - - ## Equipment.GetButtons ```pascal function TRSEquipment.GetButtons(): TRSButtonArray; ``` Returns a `TRSButtonArray` of the bottom equipment buttons. Example: ```pascal Debug(Equipment.GetButtons()); ``` - - - ## Equipment.GetButton ```pascal function TRSEquipment.GetButton(button: ERSEquipmentButton): TRSButton; ``` Returns a `TRSButton` of the specified equipment button. Example: ```pascal Debug([Equipment.GetButton(ERSEquipmentButton.PRICES)]); ``` - - - ## Equipment.FindItem ```pascal 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: ```pascal if Equipment.FindItem('Abyssal whip', bounds) then Debug(bounds); ``` - - - ## Equipment.FindItems ```pascal 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: ```pascal 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 ```pascal function TRSEquipment.ContainsItem(item: TRSItem): Boolean; function TRSEquipment.ContainsAny(items: TRSItemArray): Boolean; function TRSEquipment.ContainsAll(items: TRSItemArray): Boolean; ``` Same as {ref}`Equipment.FindItem` without the bounds. Example: ```pascal WriteLn Equipment.ContainsItem('Abyssal whip'); ``` - - - ## Equipment.ContainsAny ```pascal function TRSEquipment.ContainsAny(items: TRSItemArray): Boolean; ``` Returns true if any item on the `items` parameter is found on the equipment tab. Example: ```pascal WriteLn Equipment.ContainsAny(['Abyssal whip', 'Dragon dagger']); ``` - - - ## Equipment.ContainsAll ```pascal function TRSEquipment.ContainsAll(items: TRSItemArray): Boolean; ``` Returns true if all items on the `items` parameter are found on the equipment tab. Example: ```pascal WriteLn Equipment.ContainsAll(['Abyssal whip', 'Dragon dagger']); ``` - - - ## Equipment.DiscoverAll ```pascal 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: ```pascal if Equipment.Open() then WriteLn Equipment.DiscoverAll(); ``` - - - ## Equipment.Discover ```pascal function TRSEquipment.Discover(slot: ERSEquipmentSlot): TRSItemArray; function TRSInventory.Discover(slot: Int32): TRSItemArray; ``` Discovers what item is on the specified equipment `slot`. Example: ```pascal if Equipment.Open() then WriteLn Equipment.Discover(0); ``` - - - ## Equipment.HoverItem ```pascal function TRSEquipment.HoverItem(item: TRSItem): Boolean; ``` Attempts to hover an item, returns false if the item is not on the equipment tab. Example: ```pascal WriteLn Equipment.HoverItem('Abyssal whip'); ``` - - - ## Equipment.ClickItem ```pascal 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: ```pascal WriteLn Equipment.ClickItem('Abyssal whip'); ``` - - - ## Equipment.CountItemStack ```pascal 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: ```pascal WriteLn Equipment.CountItemStack('Broad bolts'); ``` - - - ## Equipment.ClickSlot ```pascal function TRSEquipment.ClickSlot(slot: Int32; option: String = ''): Boolean; function TRSEquipment.ClickSlot(slot: ERSEquipmentSlot; 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: ```pascal if Equipment.ClickSlot(ERSEquipmentSlot.WEAPON) then WriteLn('Left clicked the weapon slot'); if Equipment.ClickSlot(ERSEquipmentSlot.RING, 'Rub') then WriteLn('Right clicked and selected "Rub" on the ring slot'); ``` - - - ## Equipment.IsSlotUsed ```pascal function TRSEquipment.IsSlotUsed(b: TBox): Boolean; function TRSEquipment.IsSlotUsed(slot: ERSEquipmentSlot): Boolean; overload; ``` Returns true if a slot is occupied. Example: ```pascal WriteLn Equipment.IsSlotUsed(ERSEquipmentSlot.WEAPON); ``` - - - ## Equipment.CountGear ```pascal function TRSEquipment.CountGear(): Int32; ``` Returns the number of equipped items. Example: ```pascal WriteLn Equipment.CountGear(); ``` - - - ## var Equipment Global Equipment variable.