# Collection Box Methods to interact with the collection box interface. ```{figure} ../../images/collectionbox_interface.png ``` - - - (ECollectButton)= ## ECollectButton enum ```pascal ECollectButton = enum(INVENTORY, BANK); ``` Enum representing the {ref}`Collection Box` buttons. - - - (ECollectSlots)= ## ECollectSlots enum ```pascal ECollectSlots = enum(STATUS, OPERATION, THUMBNAIL, ITEM, CHANGE); ``` Enum representing the {ref}`Collection Box` slot slots. The {ref}`Collection Box`, like the {ref}`Grand Exchange` has 8 slots available, Each of those slots, has it's own 5 small slots which is what this represents: ```{figure} ../../images/collectionbox_subslots.png ``` - - - (TCollectionBox)= ## TCollectionBox type Main record to interact with the {ref}`Collection Box` interface. - - - ## CollectionBox.SetupInterface ```pascal procedure TCollectionBox.SetupInterface(); ``` Internal method used to setup the {ref}`TCollectionBox` coordinates. This is automatically called for you on the {ref}`CollectionBox variable`. - - - ## CollectionBox.IsOpen ```pascal function TCollectionBox.IsOpen(): Boolean; ``` Returns true if the collection box is open. Example: ```pascal WriteLn CollectionBox.IsOpen(); ``` - - - ## CollectionBox.WaitOpen ```pascal function TCollectionBox.WaitOpen( time: Integer = TICK; interval: Integer = -1 ): Boolean; ``` Returns true if the collection box opens within `time` milliseconds.. Example: ```pascal WriteLn CollectionBox.WaitOpen(); ``` - - - ## CollectionBox.HasChange ```pascal function TCollectionBox.HasChange(slot: Integer): Boolean; ``` Returns true if the specified collection box `slot` has change. Example: ```pascal WriteLn CollectionBox.HasChange(0); ``` - - - ## CollectionBox.CollectSlot ```pascal function TCollectionBox.CollectSlot( slot: Integer; button: ECollectButton = ECollectButton.INVENTORY ): Boolean; ``` Attempts to collect the item and change of the specified collection box `slot`. By default it attempts to collect things to your inventory, you can change it to the bank with the `button` parameter. Example: ```pascal WriteLn CollectionBox.CollectSlot(0); ``` - - - ## CollectionBox.CollectToInventory ```pascal function TCollectionBox.CollectToInventory(): Boolean; ``` Attempts to collect the items to the user {ref}`Inventory`. Example: ```pascal WriteLn CollectionBox.CollectToInventory(); ``` - - - ## CollectionBox.CollectToBank ```pascal function TCollectionBox.CollectToBank(): Boolean; ``` Attempts to collect the items to the user {ref}`Bank`. Example: ```pascal WriteLn CollectionBox.CollectToBank(); ``` - - - ## CollectionBox.Collect ```pascal function TCollectionBox.Collect( items: TItemArray; buttonProbability: Single = -1 ): Boolean; ``` Attempts to collect the specified `items` to the user {ref}`Bank`. For antiban purposes there's a small chance we just collect all items to the bank. Example: ```pascal WriteLn CollectionBox.Collect(['Molten glass']); ``` - - - ## CollectionBox.Hover ```pascal function TCollectionBox.Hover(const obj: TObject; walk: Boolean = True): Boolean; function TCollectionBox.Hover( const npc: TEntity; walk: Boolean = True ): Boolean; overload; function TCollectionBox.Hover(walk: Boolean = True): Boolean; overload; ``` Same as {ref}`Bank.Hover`. - - - ## CollectionBox.Open ```pascal function TCollectionBox.Open(const obj: TObject; walk: Boolean = True): Boolean; function TCollectionBox.Open( const npc: TEntity; walk: Boolean = True ): Boolean; overload; function TCollectionBox.Open(walk: Boolean = True): Boolean; overload; ``` Almost identical to {ref}`Bank.Open`. Example: ```pascal {$I WaspLib/main.simba} begin Map.Setup([EChunk.VARROCK]); Bank.Open(); end. ``` - - - ## CollectionBox variable Global {ref}`TCollectionBox` variable.