isOpen
isOpen: (GrandExchange) -> booleanWhether the Grand Exchange interface is open.
Grand Exchange offers, collecting, and the restock machine.
grandExchange| Method | Returns | Description |
|---|---|---|
isOpen() | boolean | Whether the Grand Exchange interface is open. |
mainOfferListOpen() | boolean | Whether the main offer list is showing, rather than one offer. |
firstOpenSlot() | number? | The first offer slot with nothing in it, as the game numbers them from 0. |
slotItemId(number) | number? | What item a slot is trading. |
slotByItemId(number) | number? | Which slot is trading an item, as the game numbers them from 0. |
open(string?) | boolean | Open the Grand Exchange. Already open is success. |
collect() | boolean | Collect finished offers to the inventory. |
collectBank() | boolean | Collect finished offers to the bank. |
confirmOffer() | boolean | Confirm the offer being set up. |
closeNotice() | boolean | Dismiss the interface's notice popup. No notice is success. |
startBuyOffer() | boolean | Start a buy offer in the first free slot. |
setOfferPrice(number) | (RunStatus, string?) | One step towards the offer being set up at this price per item. |
setOfferQuantity(number) | (RunStatus, string?) | One step towards the offer being set up for this quantity. |
typeOfferSearch(string) | boolean | Type into the offer's item search, which lists the results. It only types: selectSearchResult picks one. |
selectSearchResult(number) | boolean | Pick the search result for an item. By id, because the rows reorder. |
increasePricePercent(number) | (RunStatus, string?) | One step towards raising the offer's price by a percentage, with the interface's custom +% button. Calling again after "done" raises it a… |
newRestock({ RestockItem }) | RestockHandle | A restock of items: each row bought on the Grand Exchange and collected to the bank. The list is fixed here, and a row without an item id… |
buyLimits() | BuyLimits | The buy limits the client tracks for this account. |
isOpenisOpen: (GrandExchange) -> booleanWhether the Grand Exchange interface is open.
mainOfferListOpenmainOfferListOpen: (GrandExchange) -> booleanWhether the main offer list is showing, rather than one offer.
firstOpenSlotfirstOpenSlot: (GrandExchange) -> number?The first offer slot with nothing in it, as the game numbers them from 0.
nil when all slots are busy.slotItemIdslotItemId: (GrandExchange, number) -> number?What item a slot is trading.
slotnil when the slot is empty.slotByItemIdslotByItemId: (GrandExchange, number) -> number?Which slot is trading an item, as the game numbers them from 0.
itemIdnil when no slot is.openopen: (GrandExchange, string?) -> booleanOpen the Grand Exchange. Already open is success.
targetfalse when none is in range.collectcollect: (GrandExchange) -> booleanCollect finished offers to the inventory.
false when there is nothing to collect.collectBankcollectBank: (GrandExchange) -> booleanCollect finished offers to the bank.
false when there is nothing to collect.confirmOfferconfirmOffer: (GrandExchange) -> booleanConfirm the offer being set up.
false when no offer is being set up.closeNoticecloseNotice: (GrandExchange) -> booleanDismiss the interface's notice popup. No notice is success.
startBuyOfferstartBuyOffer: (GrandExchange) -> booleanStart a buy offer in the first free slot.
false when no slot is free.setOfferPricesetOfferPrice: (GrandExchange, number) -> (RunStatus, string?)One step towards the offer being set up at this price per item.
price"done" once the offer reads that price, "running" while a click or a typed amount is queued, and "blocked" with the reason when no offer is being set up.setOfferQuantitysetOfferQuantity: (GrandExchange, number) -> (RunStatus, string?)One step towards the offer being set up for this quantity.
quantity"done" once the offer reads that quantity, "running" while a click or a typed amount is queued, and "blocked" with the reason when no offer is being set up.typeOfferSearchtypeOfferSearch: (GrandExchange, string) -> booleanType into the offer's item search, which lists the results. It only types: selectSearchResult picks one.
textfalse when the item search is not open.selectSearchResultselectSearchResult: (GrandExchange, number) -> booleanPick the search result for an item. By id, because the rows reorder.
itemIdfalse when the results are not showing, or none of them is that item.increasePricePercentincreasePricePercent: (GrandExchange, number) -> (RunStatus, string?)One step towards raising the offer's price by a percentage, with the interface's custom +% button. Calling again after "done" raises it again.
percent"done" once the click that applies it is queued, "running" while the button's percentage is being set, and "blocked" with the reason when no offer is being set up.newRestocknewRestock: (GrandExchange, { RestockItem }) -> RestockHandleA restock of items: each row bought on the Grand Exchange and collected to the bank. The list is fixed here, and a row without an item id and a quantity raises here. It reads no game state, so make it once, when the plugin loads or starts, and keep it: its run advances one step a tick, and it opens the Grand Exchange itself.
local restock = grandExchange:newRestock({
{ itemId = ItemID.SHARK, quantity = 200 },
{ itemId = ItemID.LOBSTER, quantity = 50 },
})
function plugin:onGameTick()
local status, reason = restock:run()
if status == "done" then
-- every row was bought or skipped: read the bank to see what arrived
elseif status == "blocked" then
log:warn(reason) -- walk to the Grand Exchange, then call again
end
-- "running": it acted, or is waiting on an offer
enditemsbuyLimitsbuyLimits: (GrandExchange) -> BuyLimitsThe buy limits the client tracks for this account.