Bank

Methods to interact with the bank interface:

_images/bank_interface.png

ERSBankButtons

ERSBankButtons = enum(WORN, MENU);

Enum representing the 2 top buttons of the Bank interface.


ERSBankArrangement

ERSBankArrangement = enum(SWAP, INSERT);

Enum representing the 2 arrangement buttons of the Bank interface.


ERSWithdrawMode

ERSWithdrawMode = enum(ITEM, NOTE);

Enum representing the 2 withdraw mode buttons of the Bank interface.


ERSBankDynamicButtons

ERSBankDynamicButtons = enum(PLACEHOLDERS, SEARCH, DEPOSIT_INVENTORY, DEPOSIT_WORN);

Enum representing the 4 dynamic buttons on the right corner of the Bank interface. These buttons are dynamic because they can be enabled/disabled and shift places.


ERSBankInteraction

ERSBankInteraction = enum(WITHDRAW, DEPOSIT);

Enum representing 2 core actions you can perform on the Bank interface.


TBankPosition

Helper record to cache items positions on the Bank interface.


TRSBank

Record responsible to handle the Bank interface.


Bank.FindItemBoundaries

function TRSBank.FindItemBoundaries(): TBoxArray;

Finds item boundaries and returns them as a TBoxArray.

You have 2 ways of getting the bank slots, a static one:

ShowOnTarget(Bank.SlotBoxes);
_images/bank_static_slots.png

The bank static slots.

And a dynamic one:

ShowOnTarget(Self.FindItemBoundaries());
_images/bank_item_boundaries.png

The bank “dynamic” slots.

There are use cases for both, internally, Bank.FindItemBoundaries is usually used.


Bank.SetupInterface

procedure TRSBank.SetupInterface();

Internal method used to setup the TRSBank coordinates. This is automatically called for you on the Bank variable.


Bank.UpdateButtons

procedure TRSBank.UpdateButtons(offset: Integer);

Internal helper method used to update the buttons coordinates.

All the bank’s bottom buttons shift slightly on the X axis depending on how many dynamic buttons are visible.

Note

This is automatically called for you with Bank.IsOpen.


Bank.HasJagexAccountAd

function TRSBank.HasJagexAccountAd(): Boolean;

Returns true if the bank has the jagex account ad pop-up. This only ever shows up on non jagex accounts and tries to buy you in with bank space.

Example:

WriteLn Bank.HasJagexAccountAd();

Bank.CloseJagexAccountAd

function TRSBank.CloseJagexAccountAd(): Boolean;

Attempts to close the jagex account advert. Returns true on success.

Example:

WriteLn Bank.CloseJagexAccountAd();

Bank.IsOpen

function TRSBank.IsOpen(): Boolean;

Returns true if the bank is open.

Example:

WriteLn Bank.IsOpen();

Bank.WaitOpen

function TRSBank.WaitOpen(time: Integer; interval: Integer = -1): Boolean;

Returns true if the bank is open within time milliseconds.

Example:

WriteLn Bank.WaitOpen();

Bank.Close

function TRSBank.Close(escape: Boolean): Boolean;
function TRSBank.Close(escapeProbability: Single = 0): Boolean; overload;

Closes the bank, Depending on escape or `escapeProbability the function will either click the button or press escape key.

Example:

 WriteLn Bank.Close();

Bank.Tabs

You can access the bank tabs coordinates via the TRSBank.Tabs variable.

Example:

ShowOnTarget(Bank.Tabs);
_images/bank_tabs.png

The bank interface.


Bank.CountTabs

function TRSBank.CountTabs: Integer;

Counts the existing bank tabs.

Example:

WriteLn Bank.CountTabs();

Bank.GetCurrentTab

function TRSBank.GetCurrentTab(): Integer;

Get the current active bank tab.

Example:

tab := Bank.GetCurrentTab();
WritLn tab;
ShowOnTarget(Bank.Tabs[tab]);

Bank.OpenTab

function TRSBank.OpenTab(tab: Integer): Boolean;

Opens the specified bank tab.

Example:

WriteLn Bank.OpenTab(0);

Bank.SetArrangement

function TRSBank.SetArrangement(arrangement: ERSBankArrangement): Boolean;

Attempts to set the bank arrangement to arrangement, returns true if we succeed.

Example:

WriteLn Bank.SetArrangement(ERSBankArrangement.INSERT);

Bank.SetWithdrawMode

function TRSBank.SetWithdrawMode(noted: Boolean): Boolean;

Attempts to set the bank withdraw mode to noted if noted is true or to item if it’s false, returns true if we succeed.

Example:

WriteLn Bank.SetWithdrawMode(True);

Bank.SetQuantity

function TRSBank.SetQuantity(quantity: ERSItemQuantity): Boolean;

Attempts to set the bank quantity to quantity, returns true if we succeed.

Example:

WriteLn Bank.SetQuantity(ERSItemQuantity.FIVE);

Bank.IsSearchOpen

function TRSBank.IsSearchOpen(): Boolean;

Checks if the bank search is currently open.

Example:

WriteLn Bank.IsSearchOpen();

Bank.WaitSearchOpen

function TRSBank.WaitSearchOpen(time: Integer = 600): Boolean;

Waits time milliseconds for the bank search to be open.

Example:

WriteLn Bank.WaitSearchOpen();

Bank.OpenSearch

function TRSBank.OpenSearch(waitTime: Integer = 0): Boolean;

Attempts to open the bank search and Waits waitTime milliseconds for it to be open.

Example:

WriteLn Bank.OpenSearch();

Bank.ClearSearch

function TRSBank.ClearSearch(): Boolean;

Attempts to clear the bank search.

Example:

WriteLn Bank.ClearSearch();


Bank.CloseSearch

function TRSBank.CloseSearch(): Boolean;

Closes the bank search if it’s open.

Example:

Bank.Search('logs'); // Search for logs
Wait(1000);
Bank.CloseSearch();

Bank.HasIncinerator

function TRSBank.HasIncinerator(): Boolean;

Returns true if the bank screen has the incenerator visible.

Example:

if Bank.HasIncenerator() then
  ShowOnTarget(Self.Incenerator);

Bank.InceneratorTooltipVisible

function TRSBank.InceneratorTooltipVisible(): Boolean;

Returns true if the incenerator tooltip is visible. This is important to check when you want to interact with the bottom buttons of the bank as the tooltip will cover them.

Example:

WriteLn Bank.InceneratorTooltipVisible();

Bank.CloseInceneratorTooltip

function TRSBank.CloseInceneratorTooltip(): Boolean;

Attempts to close the incenerator tooltip. This is important to do when you want to interact with the bottom buttons of the bank as the tooltip will cover them.

Example:

if Bank.InceneratorTooltipVisible() then
  WriteLn Bank.CloseInceneratorTooltip();

Bank.HasPotionStorage

function TRSBank.HasPotionStorage(): Boolean;

Returns True/False if the bank has the potion storage menu available.

Example:

WriteLn Bank.HasPotionStorage();

Bank.PotionStorageIsOpen

function TRSBank.PotionStorageIsOpen(): Boolean;

Returns True if the potion storage is currently open.

Example:

WriteLn Bank.PotionStorageIsOpen();

Bank._FindTabText

function TRSBank._FindTabText(tpa: TPointArray; out bounds: TBox): Boolean;

Internal helper function help process the tabs text when you search.

Example:

if Bank.Search('logs') then
  if Bank._FindTabText(Target.FindColor(RSColors.TEXT_LIGHT_YELLOW, 0, bounds), bounds) then
    ShowOnTarget(bounds);

Bank.FindTab

function TRSBank.FindTab(item: TRSItem; openTab: Boolean = True): Integer;

Find the bank tab of item.

Note

A known limitation of this is that if several items match the sprite of the item (for example multiple charged jewlry) the tab retrieved will be the first one found. If you have ‘Games necklace(1)’ in tab 1 and ‘Games necklace(8)’ in tab 5 and search for the latter, you will get tab 1.

Example:

WriteLn Bank.FindTab('Molten glass');

Bank.FindScroll

function TRSBank.FindScroll(item: TRSItem): Integer;

Find the scroll position of the bank where item is visible..

Note

A known limitation of this is that if several items match the sprite of the item (for example multiple charged jewlry) the tab retrieved will be the first one found. If you have ‘Games necklace(1)’ in tab 1 and ‘Games necklace(8)’ in tab 5 and search for the latter, you will get tab 1.

Example:

WriteLn Bank.FindScroll('Molten glass');

Bank._InteractionHelper

function TRSBank._InteractionHelper(mode: ERSBankInteraction; slot: TBox; amount: Integer; useQuantityButton: Boolean): Boolean;

Internal helper method to handle both withdrawing and depositing of items.

Example:

if Bank.Items.Find('Abyssal whip', slot) the
  Bank._InteractionHelper(ERSBankInteraction.WITHDRAW, slot, 1, True);

Bank.Find

function TRSBank.Find(item: TRSItem; out data: TBankPosition; attempts: Int32 = 3): Boolean;

Attempts to find item in the back by whatever means necessary. This will search and scroll the bank until the item is found. By default attempts up to 3 times.

Item position data is returned via data.


Bank.Withdraw

function TRSBank.Withdraw(item: TRSBankItem; useQuantityButton: Boolean = True; useCache: Boolean = True): Boolean;
function TRSBank.Withdraw(item: TRSItem; useQuantityButton: Boolean = True; useCache: Boolean = True): Boolean; overload;

Attempts to withdraw item from the bank.

Example:

WriteLn Bank.Withdraw(item);

Bank.Deposit

function TRSBank.Deposit(item: TRSBankItem; useQuantityButton: Boolean = True): Boolean;
function TRSBank.Deposit(item: TRSItem; useQuantityButton: Boolean = True): Boolean; overload;

Attempts to deposit item into the bank.

Example:

WriteLn Bank.Deposit(item);

Bank.DepositDifferent

function TRSBank.DepositDifferent(items: TRSItemArray; useQuantityButton: Boolean = True): Boolean;

Attempts to deposit all items found that are not the items passed as a paremeter.

Example:

WriteLn Bank.DepositDifferent(['Abyssal whip', 'Bandos chestplate', 'Bandos tassets']);

Bank.IsDepleted

function TRSBank.IsDepleted(item: TRSBankItem; attempts: Integer = 3): Boolean;

Checks if a item is depleted in the bank. This returns true if the item.Item quantity in the bank is less than item.Quantity.

It also sets the Bank.Depleted variable to true which you can use in your script for whatever you see fit.

Example:

WriteLn Bank.IsDepleted(item);

Bank.Hover

function TRSBank.Hover(walk: Boolean = True): Boolean;

Hovers the closest bank that WaspLib is aware of.

This assumes that Map is being used and setup. It’s possible to use this with other systems but you need to configure it all manually.

It will always hover the closest bank TRSObject or TRSNPC on your loaded map.

If you are too far, it will attempt to walk closer to it.


Bank.Open

function TRSBank.Open(walk: Boolean = True): Boolean;

Opens the bank for you. This assumes that Map is being used and setup. It’s possible to use this with other systems but you need to configure it all manually.

It will always use the closest bank TRSObject or TRSNPC WaspLib is aware of on your loaded map.

If you are too far, it will attempt to walk closer to it.

Example:

{$I WaspLib/osrs.simba}
begin
  Map.Setup([ERSChunk.VARROCK]);
  Bank.Open();
end.
_images/bankopen.gif

Bank variable

Global TRSBank variable.