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.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.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 ItemFinder.Find(Item, Boxes);

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._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.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.FindItem

function TRSBank.FindItem(Item: TRSItem; out Bounds: TBox): Boolean;

Finds and returns the bounds of an item in the bank

Example

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

Bank.ContainsItem

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

Returns true/false wether a item is found in the bank or not.

Example

WriteLn Bank.ContainsItem('Coins');

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(Item: TRSBankWithdrawItem; UseQuantityButtons: Boolean): Boolean; deprecated 'User the TRSBankItem version instead';
function TRSBank.WithdrawItem(var item: TRSBankItem; useQuantityButtons: Boolean): Boolean; overload;

Finds and withdraws an item.

Parameters

Item

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 a TRSBankWithdrawItem record.

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

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

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