Docs · inventory

inventory

13 inventory commands, generated from the engine's own registry — signatures, parameters and a worked example each. A does something command acts on the game; a needs x() one answers a confident wrong answer when its client hooks are missing.

dropAll does something returns int
dropAll(id: int) -> intdropAll(name: string) -> int

Drops every one of this item and answers how many went. Composed rather than passed through: there is no API method for it. Each drop is waited for before the next is aimed, because the slots renumber when one leaves.

Drops every one of this item by name and answers how many went.

ParameterTypeWhat it does
idrequired int the item id
namerequired string the item name
Example
let dropped = dropAll(160)
let dropped = dropAll("Uncut sapphire")
inv returns list<item>
inv() -> list<item>

Everything you are carrying, in slot order.

Example
for held in inv() { if held.id == 151 { stop } }
invAmount returns int
invAmount(id: int) -> intinvAmount(name: string) -> int

How many of an item are held, adding every stack together rather than counting slots.

How many of an item are held by name, adding every stack together.

ParameterTypeWhat it does
idrequired int the item id
namerequired string the item name
Example
if invAmount(151) >= 26 { stop }
if invAmount("Coal") >= 26 { stop }
invCapacity returns int
invCapacity() -> int

How many slots the bag has. Thirty, always - RuneScape Classic has no bag upgrade - and it is a command rather than a number in your script so the number is written down in one place.

Example
let room = invCapacity() - invCount()
invContains returns bool
invContains(id: int) -> boolinvContains(name: string) -> bool

True when at least one slot holds this item.

True when at least one slot holds an item with this name.

ParameterTypeWhat it does
idrequired int the item id
namerequired string the item name
Example
if invContains(151) { stop }
if invContains("Coal") { stop }
invCount returns int
invCount() -> int

How many slots are used.

Example
if invCount() >= 28 { stop }
invFree returns int
invFree() -> int

How many slots are empty.

Example
if invFree() < 2 { stop }
invIsEmpty returns bool
invIsEmpty() -> bool

True when nothing is carried.

Example
if invIsEmpty() { stop }
invIsFull returns bool
invIsFull() -> bool

True when every slot is used.

Example
if invIsFull() { stop }
invItem returns item?
invItem(id: int) -> item?invItem(name: string) -> item?

The first slot holding this item, or none.

The first slot holding an item with this name, or none. The name is matched against the item cache, so it needs the definition hooks.

ParameterTypeWhat it does
idrequired int the item id
namerequired string the item name
Example
let ore = invItem(151)
let gem = invItem("Uncut sapphire")
invTabOpen returns bool
invTabOpen() -> bool

True when the inventory tab is the panel showing. Nothing in the bag can be clicked while it is not.

Example
if not invTabOpen() { openInvTab() }
invWielded returns list<item>
invWielded() -> list<item>

Everything you are wearing or wielding, in slot order.

Example
for worn in invWielded() { if worn.id == 4 { stop } }
openInvTab does something returns bool
openInvTab() -> bool

Shows the inventory tab and answers whether it is showing. The panel is held open by where the pointer is rather than by a click, so this is true about the moment it returns and not for ever after.

Example
openInvTab()