Item Type
Item
Represents an item in Old School RuneScape. Items can be in different locations such as inventory, bank, or equipment slots.
Methods
id()
Get the item ID.
Returns: number - The unique item ID
Example:
local item = inventory:find_first({name = "Lobster"})
if item then
print("Item ID:", item:id())
end
name()
Get the item name.
Returns: string - The item's display name
Example:
local item = inventory:find_first({id = 385})
print("Item name:", item:name()) -- "Shark"
stack_size()
Get the stack size.
Returns: number - The number of items in the stack
Example:
local coins = inventory:find_first({name = "Coins"})
if coins then
print("You have", coins:stack_size(), "coins")
end
index()
Get the inventory slot index.
Returns: number - The slot index (0-27 for inventory)
Example:
local item = inventory:find_first({name = "Tinderbox"})
if item then
print("Tinderbox is in slot", item:index())
end
click()
Human-like left click the item.
Returns: boolean - true if clicked successfully, false otherwise
Example:
local food = inventory:find_first({name = "Lobster"})
if food then
food:click() -- Eat the food
end
interact(filter_input)
Right-click and select menu option by filters.
Parameters:
| Name | Type | Description |
|---|---|---|
| filter_input | table or nil | Optional menu item filters (action, target, etc.) |
Returns: boolean - true if interaction succeeded, false otherwise
Example:
-- Use an item on a game object
local tinderbox = inventory:find_first({name = "Tinderbox"})
if tinderbox then
tinderbox:interact({action = "Use"})
-- Then click on logs
end
-- Drop an item
local junk = inventory:find_first({name = "Junk"})
if junk then
junk:interact({action = "Drop"})
end
use_on(target)
Use this item on an interactable target. Handles the full "use item on target" interaction: deselects any currently selected item, selects this item by clicking "Use", then uses it on the target.
Parameters:
| Name | Type | Description |
|---|---|---|
| target | Item, GameObject, NPC, GroundItem, or Player | The target to use this item on |
Returns: boolean - true if the interaction succeeded, false otherwise
Example:
-- Use a tinderbox on logs (item on item)
local tinderbox = inventory:find_first({name = "Tinderbox"})
local logs = inventory:find_first({name = "Logs"})
if tinderbox and logs then
tinderbox:use_on(logs)
end
-- Use a knife on logs to fletch
local knife = inventory:find_first({name = "Knife"})
local logs = inventory:find_first({name = "Logs"})
if knife and logs then
knife:use_on(logs)
end
-- Use a food item on another player
local food = inventory:find_first({name = "Shark"})
local player = players:find_first({name = "Friend"})
if food and player then
food:use_on(player)
end
move_mouse_to()
Move the mouse to this item with human-like movement. Uses the item's clickable point (e.g. inventory or bank slot).
Returns: boolean - true on success, false if the position is invalid or the move fails
Example:
local food = inventory:find_first({name = "Lobster"})
if food and food:move_mouse_to() then
mouse:click()
end
track()
Move the mouse to this item (one-shot; same as move_mouse_to()). Items do not support continuous tracking.
Returns: boolean - true on success
Example:
local item = inventory:find_first({name = "Tinderbox"})
if item then
item:track() -- One-shot move to the item
end
is_inventory_item()
Check if this is an inventory item.
Returns: boolean - true if the item is in inventory, false otherwise
is_bank_item()
Check if this is a bank item.
Returns: boolean - true if the item is in the bank, false otherwise
is_equipment_item()
Check if this is an equipment item.
Returns: boolean - true if the item is equipped, false otherwise
is_valid()
Check if this item is valid (has a valid ID > 0).
Returns: boolean - true if valid, false otherwise
Example:
local item = inventory:find_first({name = "Unknown"})
if item and item:is_valid() then
-- Item exists and is valid
end
actions()
Get the available actions for this item (e.g., 'Eat', 'Wear', 'Wield', 'Drop').
Returns: table - Array of action strings
Example:
local sword = inventory:find_first({name = "Iron sword"})
if sword then
local actions = sword:actions()
for _, action in ipairs(actions) do
print("Available action:", action)
end
-- Output: Wield, Drop, Examine
end
is_visible()
Check if item is visible in the viewport.
Returns: boolean - true if visible, false otherwise
is_stackable()
Check if item is stackable (can have multiple in one slot).
Returns: boolean - true if stackable, false otherwise
Example:
local item = inventory:find_first({name = "Coins"})
if item and item:is_stackable() then
print("This item stacks")
end
is_noted()
Check if item is noted (bank note version).
Returns: boolean - true if noted, false otherwise
Example:
local logs = inventory:find_first({name_contains = "logs"})
if logs and logs:is_noted() then
print("These are noted logs")
end
high_price()
Get the high price from the Grand Exchange price cache.
Returns: number or nil - The high price, or nil if no data available
Example:
local item = inventory:find_first({name = "Shark"})
if item then
local high = item:high_price()
if high then
print("High price:", high, "gp")
end
end
low_price()
Get the low price from the Grand Exchange price cache.
Returns: number or nil - The low price, or nil if no data available
Example:
local item = inventory:find_first({name = "Shark"})
if item then
local low = item:low_price()
if low then
print("Low price:", low, "gp")
end
end
charges()
Get the charge count from item names like 'Ring of dueling(4)' or 'Amulet of glory (3)'.
Returns: number or nil - The number of charges, or nil if item has no charges
Example:
local ring = inventory:find_first({name_contains = "Ring of dueling"})
if ring then
local charges = ring:charges()
if charges then
print("Ring has", charges, "charges remaining")
if charges < 2 then
print("Running low on charges!")
end
end
end