Bank

Methods to interact with the Bank.


Bank.IsOpen

function TRSBank.IsOpen(waitForItems: Boolean = True): Boolean;

Returns true if the Bank is visible.

waitForItems determines if the method waits up to one second for item to appears. There can be a small delay before items are visible.


Bank.Close

function TRSBank.Close(PressEscape: Boolean = False): Boolean;

Closes the bank, Depending on PressEscape the function will either click the button or press backspace.

Example:

 WriteLn Bank.Close();

Bank.FindItemBoundaries

function TRSBank.FindItemBoundaries(): TBoxArray;

Finds item boundaries. This is an internal function used to retrieve the boxes we search for items in.

Example:

Boxes := Self.FindItemBoundaries();
WriteLn ItemInterface.Find(Item, Boxes);

Bank.Setup

procedure Bank.Setup;

Initializes Bank variables.

Note

This is automatically called on the Bank variable.



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.Open()

function TRSBank.Open(P: TPoint): Boolean;

Function to open a bank at a specified P TPoint. This function will move the mouse to P and if the uptext matches the bank or a banker uptext it will open the bank.

Example:

P := CustomBankFinderFunction();
Bank.Open(P);

Bank.CountTabs

function TRSBank.CountTabs: Int32;

Counts the existing bank tabs.

Example:

WriteLn Bank.CountTabs;

Bank.GetCurrentTab

function TRSBank.GetCurrentTab(): Int32;

Get the current active bank tab.

Example:

WriteLn Bank.GetCurrentTab;

Bank.OpenTab

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

Open the specified bank tab.

Example:

Bank.OpenTab(0);

Bank._SimplifyItemName

function TRSBank._SimplifyItemName(item: TRSItem): String;

Internal function to get a human like search term for an item. This could be improved for better antiban but I decided to keep it simple since it’s not used very frequently. This basically strips the item name from things humans won’t usually type when searching, like brackets. It also makes the string lower case because people searching don’t usually care about casing. Once that’s done wee crop some characters from the final string, because humans don’t usually search the full item name, but just enough until it’s seen on screen.

Note

Could be improved to in the future for only using the relevant part of the string. For example, an human searching for ‘Amulet of glory(6)’ would probably search for ‘glory’ instead of ‘amulet of gl’.

Example:

WriteLn Bank._SimplifyItemName('Amulet of glory(6)');

Bank.FindItemTab

function TRSBank.FindItemTab(Item: TRSItem; OpenTab: Boolean = True): Int32;

Find the bank tab of an item just by knowing it’s name. This is very useful when you want to support people having items in any tab they want without much hassle for people to setup. By default it will open the banktab if the item is found. This can be changed by setting OpenTab to false. The result will be the BankTab of the item. -1 means we didn’t find a BankTab.

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.FindItemTab('Molten glass');

Bank.FindItem

function TRSBank.FindItem(Item: TRSItem; out box: TBox): Boolean;
function TRSBank.FindItem(out item: TRSBankItem; out box: TBox; attempts: Int32 = 0): Boolean; overload;

Finds and returns the bounds of an item in the bank The TRSBankItem version of the method will actually search the bank for the item while the TRSItem will not.

Example:

Bank.FindItem('Coins', Box);
Debug(Box);

Bank.ContainsItem

function TRSBank.ContainsItem(Item: TRSItem): Boolean;
function TRSBank.ContainsItem(out item: TRSBankItem): Boolean; overload;

Returns true/false whether a item is found in the bank or not. The TRSBankItem version of the method will actually search the bank for the item while the TRSItem will not.

Example:

WriteLn Bank.ContainsItem('Coins');

Bank.DiscoverAll

function TRSBank.DiscoverAllEx(): array of TRSItemArray;
function TRSBank.DiscoverAll(): TRSItemArray;

Returns all possible items found visible in the bank. The extended version returns an array of TRSItemArray while the other returns a flat TRSItemArray.

Example:

if Bank.Open() then
  WriteLn Bank.DiscoverAll();

Bank.Discover

function TRSBank.Discover(slot: Int32): TRSItemArray;

Discovers what item is on the specified bank slot.

Example:

if Bank.Open() then
  WriteLn Bank.Discover(0);

Bank.ContainsAny

function TRSBank.ContainsAny(items: TRSItemArray): Boolean;

Returns true/false whether any item in items is visible in the bank.


Bank.CountItem

function TRSBank.CountItem(Item: TRSItem): Int32;

Counts the amount of items that share the same sprite in the bank. This are extremely rare but do exist, e.g.: Edible seaweed, seaweed, giant seaweed.

Example:

WriteLn Bank.CountItem('Seaweed');

Bank.CountItemStack

function TRSBank.CountItemStack(Item: TRSItem): Int32;

Counts the stack amount of a item in the bank.

Example:

WriteLn Bank.CountItemStack('Coins');

Bank.MouseItem

function TRSBank.MouseItem(Item: TRSItem): Boolean;

Moves the mouse to an item.

Example:

Bank.MouseItem('Coins');

Bank.ClickItem

function TRSBank.ClickItem(Item: TRSItem; Option: String = ''): Boolean;

Clicks an item in the bank. If an Option is specified and it’s not in the uptext it will right click the item and look for the Option.

Example:

Bank.ClickItem('Coins', 'All');

Bank.WithdrawItem

function TRSBank.WithdrawItem(out item: TRSBankItem; useQuantityButtons: Boolean): Boolean;
function TRSBank.WithdrawItem(out item: TRSBankItem; useQuantityButtons: Boolean): Boolean; overload;
function TRSBank.WithdrawItem(item: TRSItem; useQuantityButtons: Boolean): Boolean; overload;

Finds and withdraws an item.

Parameters:

  • Item TRSItem, TRSBankWithdrawItem or TRSBankItem variable to withdraw. TRSBankItem caches the bank tab and scroll position the item is at for next uses.

  • useQuantityButtons Determines if to use the 1,5,10,X,ALL Quantity buttons.

Example:

var
  ItemToWithdraw: TRSBankWithdrawItem;
  
ItemToWithdraw.Item := 'Iron full helm'; 
ItemToWithdraw.Quantity := 5;
ItemToWithdraw.Noted := False;  

Bank.WithdrawItem(ItemToWithdraw, True);  

// OR you can shorthand by passing an open array.

Bank.WithdrawItem(['Iron full helm', 5, False], True);  

Bank.DepositItem

function TRSBank.DepositItem(Item: TRSBankDepositItem; useQuantityButtons: Boolean): Boolean; deprecated 'Use the TRSBankItem version instead';
function TRSBank.DepositItem(item: TRSBankItem; useQuantityButtons: Boolean): Boolean; overload

Deposits the specified item into the bank.

Example:

WriteLn BankDepositItem(['Coins', TRSBank.QUANTITY_ALL]);

Bank.DepositAll

function TRSBank.DepositAll: Boolean;

Depositis your inventory by clicking the deposit inventory button


var Bank

Global Bank variable.


GameTabs.Open() override;

function TRSGameTabs.Open(Tab: ERSGameTab): Boolean; override;

Overrides GameTabs.Open() to close the bank if the bank open.