Inventory ========= ---- TRSInventory.CheckIndex ~~~~~~~~~~~~~~~~~~~~~~~ :: procedure TRSInventory.CheckIndex(Index: Integer); Terminates the script if `Index` is not within 0..27 Example:: Inventory.CheckIndex(1) ---- TRSInventory.GetItemBoxes ~~~~~~~~~~~~~~~~~~~~~~~~~ :: function TRSInventory.GetItemBoxes: TBoxArray; Returns the 28 item boxes. Example:: ShowOnClient(Inventory.GetItemBoxes()); ---- TRSInventory.GetItemBoxesForItemFinder ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :: function TRSInventory.GetItemBoxesForItemFinder: TBoxArray; Extends GetItemBoxes to open the inventory tab for itemfinder. ---- TRSInventory.GetItemBoxes ~~~~~~~~~~~~~~~~~~~~~~~~~ :: function TRSInventory.GetItemBoxes(Indices: TIntegerArray): TBoxArray; Returns item boxes of the passed indices. Example:: ShowOnClient(Inventory.GetItemBoxes([0,1,27])); ---- TRSInventory.GetItemBox ~~~~~~~~~~~~~~~~~~~~~~~ :: function TRSInventory.GetItemBox(Index: Integer): TBox; Returns the item box of a inventory index. This must in the range of 0..27. Example:: ShowOnClient(Inventory.GetItemBox(1)); ---- TRSInventory.GetItemBoxNearby ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :: function TRSInventory.GetItemBoxNearby(Index: Integer; Indices: TIntegerArray): TBox; Returns a random item box from `Indices` that is weighted towards `Index`. Example:: // Return a item box nearby box 0 from boxes 1,2,3,4,5,6,7. // This will likely be box 1,4,5 as they're closest to box 0 (distance wise). ShowOnClient(Inventory.GetItemBoxNearby(0, [1,2,3,4,5,6,7])); ---- TRSInventory.PointToIndex ~~~~~~~~~~~~~~~~~~~~~~~~~ :: function TRSInventory.PointToIndex(P: TPoint): Integer; Returns the inventory box index which contains the TPoint `P`. Returns -1 if the point is not in any item box. Example:: var P: TPoint; var Slot: Integer; P := Inventory.GetItemBox(15).Middle; // Example point Slot := Inventory.PointToSlot(P); WriteLn(Slot); // 15 ---- TRSInventory.HoverIndex ~~~~~~~~~~~~~~~~~~~~~~~~ :: function TRSInventory.HoverIndex(Index: Integer): Boolean; Moves the mouse over the slot. Slot is an Integer between 0 and 27. Example:: if Inventory.HoverIndex(1) then WriteLn('Mouse is now over item #1'); ---- TRSInventory.ClickIndex ~~~~~~~~~~~~~~~~~~~~~~~ :: function TRSInventory.ClickIndex(Index: Integer): Boolean; Left clicks an inventory index. Example:: Inventory.Click(1); ---- TRSInventory.IsIndexUsed ~~~~~~~~~~~~~~~~~~~~~~~~ :: function TRSInventory.IsIndexUsed(Index: Integer): Boolean; Returns true if the inventory index contains an item. Example:: if Inventory.IsIndexUsed(1) then WriteLn('Item exists in inventory index 1'!); ---- TRSInventory.IsIndexSelected ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :: function TRSInventory.IsIndexSelected(Index: Integer): Boolean; Returns true if the item index is selected (white outline). Example:: if Inventory.IsIndexSelected(1) then WriteLn('Index 1 is selected!'); ---- TRSInventory.GetSelectedIndex ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :: function TRSInventory.GetSelectedIndex: Integer; Returns the index of the selected item (white outline). **-1** is returned if no item is selected. Example:: WriteLn(Inventory.GetSelectedIndex()); ---- TRSInventory.SetSelectedIndex ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :: function TRSInventory.SetSelectedIndex(Index: Integer): Boolean; Clicks the box index to "select" it (white outline). Example:: WriteLn(Inventory.SetSelectedIndex(2)); ---- TRSInventory.ClearSelected ~~~~~~~~~~~~~~~~~~~~~~~~~~ :: function TRSInventory.ClearSelected: Boolean; Unselects the currently selected item (white outline). Example:: if Inventory.ClearSelected() then WriteLn('No item is selected now.); ---- TRSInventory.Use ~~~~~~~~~~~~~~~~ :: function TRSInventory.Use(Slot, OtherSlot: Integer): Boolean; Selects **Slot** and uses with **OtherSlot**. Example:: Inventory.Use(1, 5); // Use item in slot 1 on Item in slot 5 ---- TRSInventory.RandomPattern ~~~~~~~~~~~~~~~~~~~~~~~~~~ :: function TRSInventory.RandomPattern: TIntegerArray; Returns a random drop pattern preset. Example:: Inventory.ShiftDropIndices(Inventory.RandomPattern()); ---- TRSInventory.ErrorPattern ~~~~~~~~~~~~~~~~~~~~~~~~~ :: function TRSInventory.ErrorPattern(Pattern: TIntegerArray = DROP_PATTERN_REGULAR; ErrorChance:Integer = 5): TIntegerArray; Returns `Pattern` with possible human like errors. Example:: Inventory.ShiftDropIndices(Inventory.ErrorPattern()); ---- TRSInventory.ShiftDropIndices ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :: function TRSInventory.ShiftDropIndices(Indices: TIntegerArray): Boolean; Shift drops an array of item indices. Example:: // Shift drops the first inventory row Inventory.ShiftDrop([0,1,2,4]) ---- TRSInventory.Count ~~~~~~~~~~~~~~~~~~ :: function TRSInventory.Count: Integer; Counts how many items are in the inventory. Example:: WriteLn('There are ', Inventory.Count(), ' items in the inventory'); ---- TRSInventory.WaitCount ~~~~~~~~~~~~~~~~~~~~~~ :: function TRSInventory.WaitCount(Count: Integer; WaitTime: Integer; Interval: Integer = -1): Boolean; Waits up to `WaitTime` for inventory count to equal `Count`. Example:: if Invenory.WaitCount(20, 1000) then WriteLn('Inventory count is now 20'); ---- TRSInventory.IsEmpty ~~~~~~~~~~~~~~~~~~~~ :: function TRSInventory.IsEmpty: Boolean; Returns true if the inventory is empty. Example:: if Inventory.IsEmpty() then WriteLn('Inventory contains no items!'); ---- TRSInventory.IsFull ~~~~~~~~~~~~~~~~~~~ :: function TRSInventory.IsFull: Boolean; Returns true if the inventory is full. Example:: if Inventory.IsFull() then WriteLn('Inventory is full'); ---- TRSInventory.Use ~~~~~~~~~~~~~~~~ :: function TRSInventory.Use(Item, OtherItem: TRSItem): Boolean; Left clicks `Item` and uses it on `OtherItem`. Example:: if Inventory.Use('knife', 'willow logs') then WriteLn('Used!'); ---- TRSInventory.ShiftDrop ~~~~~~~~~~~~~~~~~~~~~~ :: function TRSInventory.ShiftDrop(Items: TRSItemArray; Pattern: TIntegerArray): Boolean; Shift drops items using the desired pattern. Example:: // Shift drop maple & willow logs in the snake pattern Inventory.ShiftDrop(['Maple logs', 'Willow logs'], DROP_PATTERN_SNAKE);