Inventory And Item Actions
InventoryActions, BankInventoryActions, and UseItemActions provide result-aware wrappers around item widgets and item-on-target packets.
Read-only item metadata and OSRS Wiki price quotes live in
Item Info And Prices. Keep this page focused on
inventory, bank-inventory, item-on-target, and drop actions.
Inventory actions:
InventoryActions.use(name, actions...)InventoryActions.use(id, actions...)InventoryActions.use(Set<Integer>, actions...)InventoryActions.use(predicate, actions...)InventoryActions.useIndex(index, actions...)InventoryActions.useSelectedSpell(id)- clicks an item while a spell is already selected
Use InventoryQuery for contains, count, and free-slot reads; see
Query Helpers.
Inventory drop helpers:
InventoryDropPattern.rowMajor()InventoryDropPattern.reverseRowMajor()InventoryDropPattern.columnMajor()InventoryDropPattern.reverseColumnMajor()InventoryDropPattern.of(comparator)InventoryDropActions.dropNext(predicate)InventoryDropActions.dropNext(pattern, predicate)InventoryDropActions.dropNext(pattern, items)
InventoryDropActions drops at most one item per call and returns an
InteractionResult. Call it once from a tick/workflow step, inspect the result,
and re-evaluate the inventory on the next tick. It deliberately does not
bulk-click an entire inventory in one call.
InteractionResult result = InventoryDropActions.dropNext(
InventoryDropPattern.columnMajor(),
widget -> widget.getItemId() == ItemID.OAK_LOGS);
if (result.getStatus() == InteractionStatus.PACED) {
return; // try again next tick
}
Bank inventory actions:
BankInventoryActions.use(name, actions...)BankInventoryActions.use(id, actions...)BankInventoryActions.use(predicate, actions...)BankInventoryActions.useIndex(index, actions...)
Item-on-target actions:
UseItemActions.itemOnItem(sourceName, targetName)- name-based; returnsTARGET_NULLif either name is null,TARGET_NOT_FOUNDif either item is absentUseItemActions.itemOnItem(sourceItemId, targetItemId)UseItemActions.itemOnNpc(sourceItemId, npcName)UseItemActions.itemOnObject(sourceItemId, objectName)UseItemActions.itemOnTileItem(sourceItemId, tileItemId)UseItemActions.widgetOnWidget(source, target)UseItemActions.itemOnPlayer(itemId, playerName)- resolves the player by name viaPlayers.search()then delegates to thePlayeroverloadUseItemActions.itemOnPlayer(itemId, Player)- queuesPlayerPackets.queueWidgetOnPlayer; returnsTARGET_NULLif player is null,TARGET_NOT_FOUNDif item not in inventoryUseItemActions.dragAndDrop(src, dest)- queuesWidgetPackets.queueDragAndDrop; returnsWIDGET_HIDDENif either widget is hidden,TARGET_NULLif either is null
Example:
InteractionResult result = UseItemActions.itemOnNpc(995, "Banker");
if (result.failed() && result.getStatus() != InteractionStatus.PACED) {
log.debug("Use item failed: {}", result.getMessage());
}
Legacy compatibility:
InventoryInteraction and BankInventoryInteraction remain available for old boolean-returning call sites.