Bank¶
Methods to interact with the bank interface:
ERSBankArrangement enum¶
ERSBankArrangement = enum(SWAP, INSERT);
Enum representing the 2 arrangement buttons of the Bank interface.
ERSWithdrawMode enum¶
ERSWithdrawMode = enum(ITEM, NOTE);
Enum representing the 2 withdraw mode buttons of the Bank interface.
ERSBankInteraction enum¶
ERSBankInteraction = 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.
TRSBank type¶
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);
The bank static slots.¶
And a dynamic one:
ShowOnTarget(Self.FindItemBoundaries());
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.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);
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.Search¶
function TRSBank.Search(item: String): Boolean;
Searches for an item.
Example:
Bank.Search('logs'); // Search for logs
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(RSFonts.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.DepositInventory¶
function TRSbank.DepositInventory(): Boolean;
Deposits all items in the Inventory into the bank.
Example:
WriteLn Bank.DepositInventory();
Bank.DepositEquipment¶
function TRSBank.DepositEquipment(): Boolean;
Deposits all items in the worn equipment into the bank.
Example:
WriteLn Bank.DepositEquipment();
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.PrioritySort¶
function TRSBank.PrioritySort(constref l, r: TRSBankItem): Int32;
Sorting function for TRSBankItemArray.
In a nutshell, this can be used to sort a TRSBankitemArray 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 TRSBank.Hover(constref obj: TRSObject; walk: Boolean = True): Boolean;
function TRSBank.Hover(constref npc: TRSEntity; walk: Boolean = True): Boolean; overload;
function TRSBank.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 TRSObject or TRSEntity on your loaded map.
If you are too far, it will attempt to walk closer to it.
Bank.Open¶
function TRSBank.Open(constref obj: TRSObject; walk: Boolean = True): Boolean;
function TRSBank.Open(constref npc: TRSEntity; walk: Boolean = True): Boolean; overload;
function TRSBank.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/osrs.simba}
begin
Map.Setup([ERSChunk.VARROCK]);
Bank.Open();
end.
Bank variable¶
Global TRSBank variable.