Bank

Methods to interact with the bank interface:

../../images/bank_interface.png

EBankButton enum

EBankButton = enum(SETTINGS, TUTORIAL);

Enum representing the 2 top buttons of the Bank interface. The tutorial button can be hidden.


EBankSideButton enum

EBankSideButton = enum(SETTINGS, TUTORIAL);

Enum representing the side buttons of the Bank interface. The incinerator button can be hidden and the potion storage might not be unlocked.


EBankModeButton enum

EBankModeButton = enum(ARRANGEMENT, NOTES);

Enum representing the arrangement and notes buttons of the Bank interface.


EBankMiscButton enum

EBankMiscButton = enum(SEARCH, PLACEHOLDERS);

Enum representing the 2 misc buttons on the bottom of the Bank interface. These buttons can shift places because you can enable/disable EBankDepositButton enum buttons.


EBankDepositButton enum

EBankDepositButton = enum(CONTAINERS, INVENTORY, WORN);

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


EBankInteraction enum

EBankInteraction = enum(WITHDRAW, DEPOSIT);

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


TBankPosition type

Helper record to cache items positions on the Bank interface.


TBank type

Record responsible to handle the Bank interface.


Bank.SetupInterface

procedure TBank.SetupInterface();

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


Bank.UpdateButtons

procedure TBank.UpdateButtons(const tpa: TPointArray);

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 TBank.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 TBank.CloseJagexAccountAd(): Boolean;

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

Example:

WriteLn Bank.CloseJagexAccountAd();

Bank.FindItemBoundaries

function TBank.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.IsOpen

function TBank.IsOpen(): Boolean;

Returns true if the bank is open.

Example:

WriteLn Bank.IsOpen();

Bank.WaitOpen

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

Returns true if the bank is open within time milliseconds.

Example:

WriteLn Bank.WaitOpen();

Bank.Close

function TBank.Close(escape: Boolean): Boolean;
function TBank.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 TBank.Tabs variable.

Example:

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

The bank interface.


Bank.CountTabs

function TBank.CountTabs: Integer;

Counts the existing bank tabs.

Example:

WriteLn Bank.CountTabs();

Bank.GetCurrentTab

function TBank.GetCurrentTab(): Integer;

Get the current active bank tab.

Example:

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

Bank.OpenTab

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

Opens the specified bank tab.

Example:

WriteLn Bank.OpenTab(0);

Bank.SetQuantity

function TBank.SetQuantity(quantity: EItemQuantity; amount: Integer = 0): Boolean;

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

Example:

WriteLn Bank.SetQuantity(EItemQuantity.FIVE);

Bank.IsSearchOpen

function TBank.IsSearchOpen(): Boolean;

Checks if the bank search is currently open.

Example:

WriteLn Bank.IsSearchOpen();

Bank.WaitSearchOpen

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

Waits time milliseconds for the bank search to be open.

Example:

WriteLn Bank.WaitSearchOpen();

Bank.OpenSearch

function TBank.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 TBank.ClearSearch(): Boolean;

Attempts to clear the bank search.

Example:

WriteLn Bank.ClearSearch();


Bank.CloseSearch

function TBank.CloseSearch(): Boolean;

Closes the bank search if it’s open.

Example:

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

Bank.HasIncinerator

function TBank.HasIncinerator(): Boolean;

Returns true if the bank screen has the incenerator visible.

Example:

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

Bank.InceneratorTooltipVisible

function TBank.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 TBank.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 TBank.HasPotionStorage(): Boolean;

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

Example:

WriteLn Bank.HasPotionStorage();

Bank.PotionStorageIsOpen

function TBank.PotionStorageIsOpen(): Boolean;

Returns True if the potion storage is currently open.

Example:

WriteLn Bank.PotionStorageIsOpen();

Bank._FindTabText

function TBank._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(TFonts.LIGHT_YELLOW, 0, bounds), bounds) then
    ShowOnTarget(bounds);

Bank.FindTab

function TBank.FindTab(item: TItem; 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 TBank.FindScroll(item: TItem): 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 TBank._InteractionHelper(mode: EBankInteraction; 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(EBankInteraction.WITHDRAW, slot, 1, True);

Bank.Find

function TBank.Find(item: TItem; 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 TBank.Withdraw(item: TBankItem; useQuantityButton: Boolean = True; useCache: Boolean = True): Boolean;
function TBank.Withdraw(item: TItem; useQuantityButton: Boolean = True; useCache: Boolean = True): Boolean; overload;

Attempts to withdraw item from the bank.

Example:

WriteLn Bank.Withdraw(item);

Bank.Deposit

function TBank.Deposit(item: TBankItem; useQuantityButton: Boolean = True): Boolean;
function TBank.Deposit(item: TItem; useQuantityButton: Boolean = True): Boolean; overload;

Attempts to deposit item into the bank.

Example:

WriteLn Bank.Deposit(item);

Bank.DepositContainers

function Tbank.DepositContainers(): Boolean;

Deposits all items item containers in the Inventory into the bank. Example of item containers:

  • Log basket

  • Plank sack

  • Gem bag

  • Coal bag

  • etc

Example:

WriteLn Bank.DepositContainers();

Bank.DepositInventory

function Tbank.DepositInventory(): Boolean;

Deposits all items in the Inventory into the bank.

Example:

WriteLn Bank.DepositInventory();

Bank.DepositWorn

function TBank.DepositWorn(): Boolean;

Deposits all items in the worn equipment into the bank.

Example:

WriteLn Bank.DepositWorn();

Bank.DepositDifferent

function TBank.DepositDifferent(items: TItemArray; 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 TBank.IsDepleted(item: TBankItem; 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.PrioritySort

function TBank.PrioritySort(constref l, r: TBankItem): Int32;

Sorting function for TBankItemArray.

In a nutshell, this can be used to sort a TBankitemArray by prioritizing what’s currently visitble.

Do keep in mind that this uses ItemFinder to work and may be a bad idea to use in huge arrays.

Example:

bankItems := Sorted(bankItems, @Bank.PrioritySort);

Bank.Hover

function TBank.Hover(const obj: TGObject; walk: Boolean = True): Boolean;
function TBank.Hover(const npc: TEntity; walk: Boolean = True): Boolean; overload;
function TBank.Hover(walk: Boolean = True): Boolean; overload;

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 TGObject or TEntity on your loaded map.

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


Bank.Open

function TBank.Open(const obj: TGObject; walk: Boolean = True): Boolean;
function TBank.Open(const npc: TEntity; walk: Boolean = True): Boolean; overload;
function TBank.Open(walk: Boolean = True): Boolean; overload;

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 RSObject or RSNPC WaspLib is aware of on your loaded map.

If you are too far, it will attempt to walk closer to it by default unless you set the walk parameter to False.

Example:

{$I WaspLib/main.simba}
begin
  Map.Setup([EChunk.VARROCK]);
  Bank.Open();
end.
../../images/bankopen.gif

Bank.IsSlotLocked

function TBank.IsSlotLocked(slot: Integer): Boolean;

Checks if an inventory slot is locked. This assumes that the bank interface is open as locked slots are only visible with the bank open.

Example:

{$I WaspLib/main.simba}
begin
  if Bank.IsSlotLocked(0) then
    WriteLn('Slot 0 is locked');
end.

Bank.GetLockedSlots

function TBank.GetLockedSlots(): TIntegerArray;

Returns all inventory slots that are locked.

Example:

{$I WaspLib/main.simba}
begin
  WriteLn(Bank.GetLockedSlots());
end.

Bank.LockSlot

function TBank.LockSlot(slot: Integer): Boolean;

Locks an inventory slot and returns confirmation the slot was locked.

Example:

{$I WaspLib/main.simba}
begin
  if Bank.LockSlot(0) then
    WriteLn('Slot 0 has been locked');
end.

Bank.UnlockSlot

function TBank.UnlockSlot(slot: Integer): Boolean;

Unlocks an inventory slot and returns confirmation the slot was unlocked.

Example:

{$I WaspLib/main.simba}
begin
  if Bank.UnlockSlot(0) then
    WriteLn('Slot 0 has been unlocked');
end.

Bank variable

Global TBank type variable.