# Inventory Methods to interact with the inventory gametab. ```{figure} ../../images/inventory.png ``` - - - ## TRSInventory Main record responsible with handling the inventory gametab. - - - ## Inventory.SetupGameTab ```pascal procedure TRSInventory.SetupGameTab(); ``` Internal method used to setup the {ref}`TRSInventory` coordinates. This is automatically called for you on the {ref}`Inventory variable`. - - - ## Inventory.IsOpen ```pascal function TRSInventory.IsOpen(): Boolean; ``` Returns true/false if the inventory is open. Example: ```pascal WriteLn Inventory.IsOpen(); ``` - - - ## Inventory.Open ```pascal function TRSInventory.Open(): Boolean; ``` Attempts to open the inventory gametab. Example: ```pascal WriteLn Inventory.Open(); ``` - - - ## Inventory.IsFull ```pascal function TRSInventory.IsFull(): Boolean; ``` Returns true/false if the inventory is full. Example: ```pascal WriteLn Inventory.IsFull(); ``` - - - ## Inventory.IsSelected ```pascal function TRSInventory.IsSelected(slot: TBox): Boolean; function TRSInventory.IsSelected(slot: Integer): Boolean; overload; function TRSInventory.IsSelected(item: TRSItem): Boolean; overload; ``` Returns true/false if the specified `slot` or `item` is currently selected. Example: ```pascal WriteLn Inventory.IsSelected('Vial'); ``` - - - ## Inventory.GetSelected ```pascal function TRSInventory.GetSelected(): Integer; ``` Returns the selected slot number if any. -1 is returned if no selected slot is found. Example: ```pascal WriteLn Inventory.GetSelected(); ``` - - - ## Inventory.Select ```pascal function TRSInventory.Select(slot: Integer; wait: Boolean = False): Boolean; function TRSInventory.Select(item: TRSItem; wait: Boolean = False): Boolean; overload; ``` Attempts to select the specified `slot` or `item`. If `wait` is set to true we wait for confirmation that we succeeded. Example: ```pascal WriteLn Inventory.Select('Coins'); ``` - - - ## Inventory.Combine ```pascal function TRSInventory.Combine(slotA, slotB: Integer): Boolean; function TRSInventory.Combine(itemA, itemB: TRSItem): Boolean; overload; ``` Attempts to combine 2 slots or 2 items. Example: ```pascal WriteLn Inventory.Combine('Coins', 'Asgarnian ale'); ``` - - - ## Inventory.Drop ```pascal function TRSInventory.Drop(slots: TIntegerArray; attempts: Integer = 5): Boolean; function TRSInventory.Drop(items: TRSItemArray; pattern: TIntegerArray = []): Boolean; overload; ``` Attempts to drop the specified `slots` or `items`. Example: ```pascal WriteLn Inventory.Drop('Oak logs'); ``` - - - ## Inventory.ShiftDrop ```pascal function TRSInventory.ShiftDrop(slots: TIntegerArray; attempts: Integer = 5): Boolean; function TRSInventory.ShiftDrop(slots, pattern: TIntegerArray): Boolean; overload; function TRSInventory.ShiftDrop(items: TRSItemArray; pattern: TIntegerArray): Boolean; overload; ``` Attempts to shift drop the specified `slots` or `items`. You can optionally specify a "drop" pattern. If we determine that we can't shift drop because the setting is off, `TRSInventory.Drop()` is used as a fallback. Example: ```pascal WriteLn Inventory.ShiftDrop('Maple logs'); ``` - - - ## Inventory variable Global {ref}`TRSInventory` variable.