Inventory

The inventory file holds functions and procedures that are related to the runescape inventory


type TRSInventory

The type that holds functions and properties of the Runescape inventory gametab.


var Inventory

Variable that stores functions and properties of the Runescape inventory gametab.


Drop patterns

Column wise and “reversed” column wise (S-style):

DROP_PATTERN_REGULAR, DROP_PATTERN_REGULAR_R

Column wise snake-style patterns and “reversed” version:

DROP_PATTERN_SNAKE, DROP_PATTERN_SNAKE_R

By row, from to-left, down to bottom right, it’s reverse starts in top-right down to bottom right.

DROP_PATTERN_TOPDOWN, DROP_PATTERN_TOPDOWN_R


Inventory.ErrorPattern

function TRSInventory.ErrorPattern(Pattern: TIntArray=DROP_PATTERN_REGULAR; ErrorChance:Int32=5): TIntegerArray;

Given a pattern and an upper limit of errors in percent, it will swap around some values and return a “errorized” drop-pattern

Example:

Inventory.DropItems(Inventory.ErrorPattern(DROP_PATTERN_REGULAR, 10));

Inventory.Open

function TRSInventory.Open(): Boolean;

Opens the interface


Inventory.IsOpen

function TRSInventory.IsOpen(maxWait:Int32=0): Boolean;

Checks if the interface is already open.


Inventory.IsSlotValid

function TRSInventory.IsSlotValid(idx: Int32): Boolean;

Returns true if the given slot is within a valid range.

Note

by slacky


Inventory.PointToSlot

function TRSInventory.PointToSlot(pt:TPoint): Int32;

Returns the slot-index under the given TPoint. If it’s not over a slot then -1 is returned

Note

by slacky


Inventory.MouseSlot

procedure TRSInventory.MouseSlot(idx:Int32; btn: Integer = mouse_Move);

Moves the moise over the given slot-index.

Note

by slacky


Inventory.IsFull

function TRSInventory.IsFull(): Boolean;

Returns True if the inventory can’t hold anymore items

Note

by slacky


Inventory.GetSlotBox

function TRSInventory.GetSlotBox(idx:Int32): TBox;

Returns the bounding box covering the given slot-index.

Note

by slacky


Inventory.IsSlotUsed

function TRSInventory.IsSlotUsed(idx:Int32): Boolean;

Returns true if the given slot is occupied.

Note

by slacky


Inventory.GetUsedSlots

function TRSInventory.GetUsedSlots(idx:Int32): TIntegerArray;

Returns all the occupied slot-indices.

Note

by slacky


Inventory.Count

function TRSInventory.Count: Int32;

Returns the number of used slots


Inventory.DropItems

function TRSInventory.DropItems(Slots:TIntegerArray = DROP_PATTERN_REGULAR);

Drops the given items. It’s order-sensitive which means unless you want it to jump randomly all over the inventory dropping items, you give it a ordered drop-pattern.

Note

by slacky

Examples:

// drops all items in a "snake order" / "Z"-order
Inventory.DropItems(DROP_PATTERN_SNAKE);
Inventory.DropItems([0..3]); // drops the four first items

Inventory.DropItemsExcept

procedure TRSInventory.DropItemsExcept(ignoreSlots:TIntegerArray; Slots:TIntegerArray = DROP_PATTERN_REGULAR);

Drops all the given items Slots except for the items in IgnoreSolots

Note

by slacky


Inventory.FindItem

function TRSInventory.FindItem(Mask: TMask; Tolerance:Int32 = 30; ContourTolerance:Int32 = 30; MaxToFind:Byte = 28): TIntegerArray;
function TRSInventory.FindItem(DTM: Integer; MaxToFind:Byte = 28): TIntegerArray; overload;
function TRSInventory.FindItem(BMP: Integer; Tolerance:Int32; MaxToFind:Byte): TIntegerArray; overload;

Find the slots of the given item defined by a TMask, DTM, or BMP.

Note

Last parameter is not defaulted in the last overload FindItem(BMP..) for technical reasons._

Example:

itemArr := Inventory.FindItem(myMask);
if itemArr = [] then
  WriteLn('Not found');

Inventory.Count

function TRSInventory.Count(Mask: TMask; Tolerance, ContourTolerance:Int32=30): Int32; overload;
function TRSInventory.Count(DTM: Integer): Int32; overload;
function TRSInventory.Count(BMP: Integer; Tolerance:Int32): Int32; overload;

Counts the number of slots containing this item


Inventory.Contains

function TRSInventory.Contains(Mask: TMask; Tolerance, ContourTolerance:Int32=30): Boolean;
function TRSInventory.Contains(DTM: Integer): Boolean; overload;
function TRSInventory.Contains(BMP: Integer; Tolerance:Int32): Boolean; overload;

Returns true if the inventory contains the given item


Inventory.GetActiveSlot

function TRSInventory.GetActiveSlot(): Int8;

Returns the index to the current active slot, returns -1 if none.


Inventory.Use

function TRSInventory.Use(Slot: Int32): Boolean;

RS correct alias for Inventory.ActivateSlot.


Inventory.ActivateSlot

function TRSInventory.ActivateSlot(Slot: Int32): Boolean;

Activates (Presses) the given slot, however if Slot is -1 then it will disable the current active slot.


Inventory.WaitCount

function TRSInventory.WaitCount(Amount: Int32; Time: Int32; Compare: TComparator = __EQ__): Boolean;

Waits for intentory amount to meet expected size. By default it waits till it’s equal to given Amount, but can wait till it’s not equal, less than or greater than.