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:

ParameterTypeRequiredDescription
bankstringYesBank 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, or nil if 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"), or nil if 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:

ParameterTypeRequiredDescription
bankstringYesBank enum value from bank.Bank (e.g., bank.Bank.VARROCK_EAST, bank.Bank.EDGEVILLE)

Returns:

  • Tile? - The tile position of the bank, or nil if 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_KHARID
  • bank.Bank.ARCEUUS
  • bank.Bank.ARDOUGNE_NORTH
  • bank.Bank.ARDOUGNE_SOUTH
  • bank.Bank.BARBARIAN_OUTPOST
  • bank.Bank.BLAST_FURNACE_BANK
  • bank.Bank.BLAST_MINE
  • bank.Bank.BURGH_DE_ROTT
  • bank.Bank.CAMELOT
  • bank.Bank.CAM_TORUM
  • bank.Bank.CANIFIS
  • bank.Bank.CASTLE_WARS
  • bank.Bank.CATHERBY
  • bank.Bank.DIHN_BANK
  • bank.Bank.DRAYNOR
  • bank.Bank.DUEL_ARENA
  • bank.Bank.DWARF_MINE_BANK
  • bank.Bank.EDGEVILLE
  • bank.Bank.FALADOR_EAST
  • bank.Bank.FALADOR_WEST
  • bank.Bank.FARMING_GUILD
  • bank.Bank.FEROX_ENCLAVE
  • bank.Bank.FISHING_GUILD
  • bank.Bank.FOSSIL_ISLAND
  • bank.Bank.FOSSIL_ISLAND_WRECK
  • bank.Bank.GNOME_BANK
  • bank.Bank.GNOME_TREE_BANK_SOUTH
  • bank.Bank.GNOME_TREE_BANK_WEST
  • bank.Bank.GRAND_EXCHANGE
  • bank.Bank.GREAT_KOUREND_CASTLE
  • bank.Bank.HALLOWED_SEPULCHRE
  • bank.Bank.HOSIDIUS
  • bank.Bank.HOSIDIUS_KITCHEN
  • bank.Bank.HUNTERS_GUILD
  • bank.Bank.JATIZSO
  • bank.Bank.ISLE_OF_SOULS
  • bank.Bank.LANDS_END
  • bank.Bank.LOVAKENGJ
  • bank.Bank.LUMBRIDGE_BASEMENT
  • bank.Bank.LUMBRIDGE_TOP
  • bank.Bank.LUNAR_ISLE
  • bank.Bank.MINING_GUILD
  • bank.Bank.MOR_UL_REK
  • bank.Bank.MOTHERLOAD
  • bank.Bank.MOUNT_KARUULM
  • bank.Bank.NARDAH
  • bank.Bank.NEITIZNOT
  • bank.Bank.PEST_CONTROL
  • bank.Bank.PISCARILIUS
  • bank.Bank.PRIFDDINAS
  • bank.Bank.ROGUES_DEN
  • bank.Bank.RUINS_OF_UNKAH
  • bank.Bank.SHANTY_PASS
  • bank.Bank.SHAYZIEN_CHEST
  • bank.Bank.SHAYZIEN_BANK
  • bank.Bank.SHILO_VILLAGE
  • bank.Bank.SOPHANEM
  • bank.Bank.SULPHUR_MINE
  • bank.Bank.TZHAAR
  • bank.Bank.VARLAMORE_EAST
  • bank.Bank.VARLAMORE_WEST
  • bank.Bank.VARROCK_EAST
  • bank.Bank.VARROCK_WEST
  • bank.Bank.VINERY
  • bank.Bank.VINERY_BANK
  • bank.Bank.VOLCANO_BANK
  • bank.Bank.WINTERTODT
  • bank.Bank.WOODCUTTING_GUILD
  • bank.Bank.YANILLE
  • bank.Bank.ZANARIS
  • bank.Bank.ZEAH_SAND_BANK
  • bank.Bank.HUEYCOATL_BANK
  • bank.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:

ParameterTypeRequiredDescription
item_idnumberYesItem 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:

ParameterTypeRequiredDescription
item_idnumberYesItem 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:

ParameterTypeRequiredDescription
filtertableNoFilter options

Returns:

  • Item? - First matching item

Filters:

  • All filters from Item type are supported, including:
    • name - Exact name match
    • name_contains - Name contains text
    • name_any - Match if name equals any in array
    • name_contains_any - Match if name contains any substring in array
    • id - Exact item ID
    • ids - 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:

ParameterTypeRequiredDescription
filtertableNoFilter options (same as find_first)

Returns:

  • table - Array of items

deposit

bank:deposit(filter: table?, quantity: number|string?) -> boolean

Deposit items to bank.

Parameters:

ParameterTypeRequiredDescription
filtertableNoItem filter
quantitynumberstring, optionalNo

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:

ParameterTypeRequiredDescription
filtertableNoItem filter
quantitynumberstring, optionalNo

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:

ParameterTypeRequiredDescription
tabnumberYesTab 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:

ParameterTypeRequiredDescription
notedbooleanYesTrue 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:

ParameterTypeRequiredDescription
enabledbooleanYesTrue to enable

Returns:

  • boolean - True if successful

set_default_quantity

bank:set_default_quantity(quantity: number|string) -> boolean

Set default withdrawal quantity.

Parameters:

ParameterTypeRequiredDescription
quantitynumberstringYes

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