Skip to main content

Grand Exchange Actions

Verification boundary

This page describes the committed source behavior. It omits certifying revision-sensitive RuneLite UI, packet, or in-game outcomes; treat those as live-client verification pending unless the page records direct evidence.

Caution

The documented close() source path lacks live-validation for dynamic GE children. The validation ledger captured a Close control requiring child index 11, while packed widget ID alone proved insufficient. Do not treat a queued SUCCESS as proof that the interface closed. Repeat the close scenario after any widget-dispatch change.

GrandExchangeActions (com.n3plugins.Api.actions) manages independent GE actions: open or close the nearest GE, collect finished offers, cancel offers, check whether the interface stays open, and build paced buy/sell offer pipelines. Each acting method returns an InteractionResult or a TaskPipeline routing steps through ActionPacer.

if (!GrandExchangeActions.isOpen()) {
GrandExchangeActions.openNearest(); // walk to and open the nearest GE
}
GrandExchangeActions.collectAll(); // collect coins and bought/sold items
GrandExchangeActions.close(); // close the GE before other interface work
MethodReturnsDoes
openNearest()InteractionResultwalks to and opens the nearest Grand Exchange
collectAll()InteractionResultcollects all completed offers
cancelOffer(int slot)InteractionResultcancels a one-based GE offer slot
close()InteractionResultcloses the open GE interface
isPriceWarningVisible()booleanchecks if a price discrepancy warning modal is open
handlePriceWarning()booleanconfirms and dismisses a visible price warning modal
createBuyPipeline(int itemId, int quantity, int priceEach)TaskPipelineopens a free slot, sets item, price, quantity, confirms, handles price warnings, and waits for a submitted buy offer
createSellPipeline(int itemId, int quantity, int priceEach)TaskPipelineopens a free slot, sets item, price, quantity, confirms, and waits for a submitted sell offer

Building offers

GrandExchangeActions constructs the generic buy and sell offer pipelines: open a free slot, wait for the setup page, set item, set price, set quantity, confirm the offer, and wait until the submitted offer appears in the live GE offers. Plugin-specific policy remains at the caller. The shared action class omits pricing, buy-limit decisions, retry rules, budget reservation, and pending-offer accounting. Market Alcher serves as the reference consumer for the buy pipeline. See market-alcher and task-pipeline.

For open/page state, slot state, and prices, use the GE query and widget helpers in query-helpers. GrandExchangeActions exposes isOpen(), close(), openNearest(), collectAll(), collectToBank(), and cancelOffer(slot) for scripts needing an InteractionResult surface (see automation-api).

Pacing and guards

openNearest and collectAll check ActionPacer.isReady(...) before queuing a packet. They return InteractionResult.PACED when the gate remains closed, letting a caller retry each tick until the pacer clears. A call made while the GE sits closed returns a non-success status and skips throwing an error.

close() succeeds when the GE remains closed. Otherwise, it waits for ActionPacer, searches the visible GE interface tree for a widget exposing Close, and fails with WIDGET_NOT_FOUND instead of sending a guessed child packet.