GroundItemQuery

Group
Queries
Methods
14
Fields
None

Getting one

scene:groundItems()

Methods

MethodReturnsDescription
named(string)GroundItemQueryKeep only those whose whole item name matches, ignoring case and markup: | separates alternatives and * is any run of characters.
containing(string)GroundItemQueryKeep only those whose item name contains the text, ignoring case and markup: | separates alternatives.
ids({ number })GroundItemQueryKeep only these ids. A noted id and its unnoted id are the same item here.
within(number)GroundItemQueryKeep only those within a radius of the local player.
withinArea(WorldArea)GroundItemQueryKeep only those inside an area.
reachable()GroundItemQueryKeep only those the local player can walk to.
unitGeValueAtLeast(number)GroundItemQueryKeep only piles whose ONE item is worth at least this at Grand Exchange price, a noted pile as the item it notes.
unitAlchValueAtLeast(number)GroundItemQueryKeep only piles whose ONE item alchs for at least this, a noted pile as the item it notes.
stackValueAtLeast(number)GroundItemQueryKeep only piles worth at least this whole: price times quantity, coins at 1 each and platinum tokens at 1,000.
mine()GroundItemQueryKeep the stacks nobody else owns: the player's, unowned and group stacks (item:getOwnership() ~= TileItem.OWNERSHIP_OTHER).
lootable()GroundItemQueryKeep the stacks the player may pick up: mine ones, or every stack when the account is not an ironman.
count()numberHow many survived the narrowing. Consumes the query.
nearest()TileItem?The nearest survivor. Consumes the query.
collect(){ TileItem }Every survivor, nearest first. Consumes the query.

Returned by

MethodReturnsDescription
SceneDomain.groundItemsGroundItemQueryA query over every item on the floor, whose terminals hand out TileItem handles (item:getTile() is where one lies).

Method details

named

named: (GroundItemQuery, string) -> GroundItemQuery

Keep only those whose whole item name matches, ignoring case and markup: | separates alternatives and * is any run of characters.

names
The name pattern.

stackValueAtLeast

stackValueAtLeast: (GroundItemQuery, number) -> GroundItemQuery

Keep only piles worth at least this whole: price times quantity, coins at 1 each and platinum tokens at 1,000.

local stack = scene:groundItems():within(10):stackValueAtLeast(5000):lootable():nearest()
if stack then stack:interact("Take") end
coins
The lowest stack value to keep.

mine

mine: (GroundItemQuery) -> GroundItemQuery

Keep the stacks nobody else owns: the player's, unowned and group stacks (item:getOwnership() ~= TileItem.OWNERSHIP_OTHER).

scene:groundItems():ids(ids):within(dist), then :mine() for stacks nobody else owns or :lootable() for stacks the player may pick up, then :collect(), nearest first. Stacks at the same distance keep the scan order.

lootable

lootable: (GroundItemQuery) -> GroundItemQuery

Keep the stacks the player may pick up: mine ones, or every stack when the account is not an ironman.

Then :nearest() and interact("Take") take that stack (its id and its tile). Stacks at the same distance keep the scan order.