Bank API
Interact with bank interface, deposit/withdraw items, manage tabs and settings.
Core Functions
opened
bank:opened() -> boolean
Check if bank is open.
Returns:
boolean- True if bank interface visible
is_open
bank:is_open() -> boolean
Check if bank is open.
Returns:
boolean- True if bank interface visible
open
bank:open() -> boolean
Open the nearest bank.
Returns:
boolean- True if successful
open_nearest
bank:open_nearest() -> boolean
Open the nearest bank.
Returns:
boolean- True if successful
open_or_move_to
bank:open_or_move_to(bank: string) -> boolean
Try to open the bank. If it fails, move to the specified bank location and then try to open again.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
bank | string | Yes | Bank enum value from bank.Bank (e.g., bank.Bank.VARROCK_EAST, bank.Bank.EDGEVILLE) |
Returns:
boolean- True if bank is open after the operation
Example:
-- Try to open bank, move to Varrock East if needed
if bank:open_or_move_to(bank.Bank.VARROCK_EAST) then
logger:info("Bank opened successfully")
-- Do banking operations
else
logger:error("Failed to open bank")
end
-- Use Edgeville bank
bank:open_or_move_to(bank.Bank.EDGEVILLE)
nearest_tile
bank:nearest_tile() -> Tile?
Get the tile of the nearest bank. First checks for nearby bank booths or banker NPCs. If none are found, uses pathfinding to find the nearest bank location from all available banks.
Returns:
Tile?- The tile of the nearest bank, ornilif no bank is found
Example:
local bank_tile = bank:nearest_tile()
if bank_tile then
logger:info("Nearest bank at: " .. bank_tile.x .. ", " .. bank_tile.y)
end
nearest_bank
bank:nearest_bank() -> string?
Find the nearest bank location using pathfinding. Iterates over all bank locations and uses OmniWalker to find the shortest path, returning the bank enum value.
Returns:
string?- The bank enum value (e.g.,"Edgeville","VarrockEast"), ornilif no reachable bank is found
Example:
local nearest = bank:nearest_bank()
if nearest then
logger:info("Nearest bank: " .. nearest)
-- Use the bank
bank:open_or_move_to(nearest)
end
tile_for
bank:tile_for(bank: string) -> Tile?
Get the tile position for a bank location.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
bank | string | Yes | Bank enum value from bank.Bank (e.g., bank.Bank.VARROCK_EAST, bank.Bank.EDGEVILLE) |
Returns:
Tile?- The tile position of the bank, ornilif the bank is invalid
Example:
local edgeville_tile = bank:tile_for(bank.Bank.EDGEVILLE)
if edgeville_tile then
logger:info("Edgeville bank at: " .. edgeville_tile.x .. ", " .. edgeville_tile.y)
end
Available Banks:
bank.Bank.AL_KHARIDbank.Bank.ARCEUUSbank.Bank.ARDOUGNE_NORTHbank.Bank.ARDOUGNE_SOUTHbank.Bank.BARBARIAN_OUTPOSTbank.Bank.BLAST_FURNACE_BANKbank.Bank.BLAST_MINEbank.Bank.BURGH_DE_ROTTbank.Bank.CAMELOTbank.Bank.CAM_TORUMbank.Bank.CANIFISbank.Bank.CASTLE_WARSbank.Bank.CATHERBYbank.Bank.DIHN_BANKbank.Bank.DRAYNORbank.Bank.DUEL_ARENAbank.Bank.DWARF_MINE_BANKbank.Bank.EDGEVILLEbank.Bank.FALADOR_EASTbank.Bank.FALADOR_WESTbank.Bank.FARMING_GUILDbank.Bank.FEROX_ENCLAVEbank.Bank.FISHING_GUILDbank.Bank.FOSSIL_ISLANDbank.Bank.FOSSIL_ISLAND_WRECKbank.Bank.GNOME_BANKbank.Bank.GNOME_TREE_BANK_SOUTHbank.Bank.GNOME_TREE_BANK_WESTbank.Bank.GRAND_EXCHANGEbank.Bank.GREAT_KOUREND_CASTLEbank.Bank.HALLOWED_SEPULCHREbank.Bank.HOSIDIUSbank.Bank.HOSIDIUS_KITCHENbank.Bank.HUNTERS_GUILDbank.Bank.JATIZSObank.Bank.ISLE_OF_SOULSbank.Bank.LANDS_ENDbank.Bank.LOVAKENGJbank.Bank.LUMBRIDGE_BASEMENTbank.Bank.LUMBRIDGE_TOPbank.Bank.LUNAR_ISLEbank.Bank.MINING_GUILDbank.Bank.MOR_UL_REKbank.Bank.MOTHERLOADbank.Bank.MOUNT_KARUULMbank.Bank.NARDAHbank.Bank.NEITIZNOTbank.Bank.PEST_CONTROLbank.Bank.PISCARILIUSbank.Bank.PRIFDDINASbank.Bank.ROGUES_DENbank.Bank.RUINS_OF_UNKAHbank.Bank.SHANTY_PASSbank.Bank.SHAYZIEN_CHESTbank.Bank.SHAYZIEN_BANKbank.Bank.SHILO_VILLAGEbank.Bank.SOPHANEMbank.Bank.SULPHUR_MINEbank.Bank.TZHAARbank.Bank.VARLAMORE_EASTbank.Bank.VARLAMORE_WESTbank.Bank.VARROCK_EASTbank.Bank.VARROCK_WESTbank.Bank.VINERYbank.Bank.VINERY_BANKbank.Bank.VOLCANO_BANKbank.Bank.WINTERTODTbank.Bank.WOODCUTTING_GUILDbank.Bank.YANILLEbank.Bank.ZANARISbank.Bank.ZEAH_SAND_BANKbank.Bank.HUEYCOATL_BANKbank.Bank.NONE
close
bank:close() -> boolean
Close bank interface.
Returns:
boolean- True if successful
items
bank:items() -> table
Get all banked items.
Returns:
table- Array of Item objects
item_count
bank:item_count() -> number
Get number of item stacks in bank.
Returns:
number- Item count
contains
bank:contains(item_id: number) -> boolean
Check if item exists in bank.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
item_id | number | Yes | Item ID |
Returns:
boolean- True if item in bank
count_of
bank:count_of(item_id: number) -> number
Get total count of item in bank.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
item_id | number | Yes | Item ID |
Returns:
number- Total count
is_full
bank:is_full() -> boolean
Check if bank is full.
Returns:
boolean- True if full
find_first
bank:find_first(filter: table?) -> Item?
Find first item matching filter.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
filter | table | No | Filter options |
Returns:
Item?- First matching item
Filters:
- All filters from Item type are supported, including:
name- Exact name matchname_contains- Name contains textname_any- Match if name equals any in arrayname_contains_any- Match if name contains any substring in arrayid- Exact item IDids- Array of item IDs- Price filters (see Inventory API for full list of price filters)
Example:
-- Find specific item
local coins = bank:find_first({name = "Coins"})
-- Find items with any of multiple names
local food = bank:find_first({
name_any = {"Lobster", "Swordfish", "Shark"}
})
-- Find items containing any substring
local potions = bank:find_all({
name_contains_any = {"potion", "brew"}
})
find_all
bank:find_all(filter: table?) -> table
Find all items matching filter.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
filter | table | No | Filter options (same as find_first) |
Returns:
table- Array of items
deposit
bank:deposit(filter: table?, quantity: number|string?) -> boolean
Deposit items to bank.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
filter | table | No | Item filter |
quantity | number | string, optional | No |
Returns:
boolean- True if successful
Example:
bank:deposit({id = 995}, "all") -- Deposit all coins
bank:deposit({name = "Bones"}, 10) -- Deposit 10 bones
withdraw
bank:withdraw(filter: table?, quantity: number|string?) -> boolean
Withdraw items from bank.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
filter | table | No | Item filter |
quantity | number | string, optional | No |
Returns:
boolean- True if successful
deposit_inventory
bank:deposit_inventory() -> boolean
Deposit entire inventory.
Returns:
boolean- True if successful
deposit_equipment
bank:deposit_equipment() -> boolean
Deposit all equipped items.
Returns:
boolean- True if successful
Tab Management
current_tab
bank:current_tab() -> number
Get active tab number.
Returns:
number- Tab index
switch_tab
bank:switch_tab(tab: number) -> boolean
Switch to specific tab.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
tab | number | Yes | Tab index |
Returns:
boolean- True if successful
Settings
is_withdraw_noted
bank:is_withdraw_noted() -> boolean
Check if withdraw noted mode enabled.
Returns:
boolean- True if noted mode on
set_withdraw_noted
bank:set_withdraw_noted(noted: boolean) -> boolean
Set withdraw noted mode.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
noted | boolean | Yes | True for noted, false for unnoted |
Returns:
boolean- True if successful
placeholders_enabled
bank:placeholders_enabled() -> boolean
Check if placeholders enabled.
Returns:
boolean- True if enabled
set_placeholders
bank:set_placeholders(enabled: boolean) -> boolean
Enable/disable placeholders.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
enabled | boolean | Yes | True to enable |
Returns:
boolean- True if successful
set_default_quantity
bank:set_default_quantity(quantity: number|string) -> boolean
Set default withdrawal quantity.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
quantity | number | string | Yes |
Returns:
boolean- True if successful
Common Patterns
Banking Session
local function bank_items()
if not bank:opened() then
if not bank:open_nearest() then
logger:error("Failed to open bank")
return false
end
sleep(1000) -- Wait for bank to open
end
-- Deposit inventory
if not bank:deposit_inventory() then
logger:error("Failed to deposit")
return false
end
sleep(500)
-- Withdraw supplies
bank:withdraw({name_contains = "potion"}, 5)
return true
end
Item Management
local function ensure_supplies(item_id, needed_count)
if not bank:opened() then
bank:open_nearest()
sleep(1000)
end
local in_bank = bank:count_of(item_id)
local in_inv = inventory:count_of(item_id)
local total = in_bank + in_inv
if total < needed_count then
logger:warn("Not enough supplies!")
return false
end
if in_inv < needed_count then
local need = needed_count - in_inv
bank:withdraw({id = item_id}, need)
end
return true
end
Tab Organization
local function organize_by_tabs()
-- Switch to different tabs and organize
for tab = 0, 7 do
if bank:switch_tab(tab) then
logger:info("Tab " .. tab .. ": " .. bank:item_count() .. " items")
end
end
end
Related APIs
- Inventory API - Inventory management
- Equipment API - Equipment management