Docs · customshop

customshop

17 customshop 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.

customShopAvailable returns bool
customShopAvailable() -> bool

Whether the custom-shop hooks are published.

Example
if not customShopAvailable() { stop }
customShopBuy does something returns bool
customShopBuy(id: int, amount: int) -> boolcustomShopBuy(name: string, amount: int) -> bool

Buys from the shop and waits for the bag to gain them. Refuses without sending when the shop does not stock it, has none left, or the currency in hand will not cover it.

Buys by name and waits for the bag to gain them.

ParameterTypeWhat it does
idrequired int the item id
amountrequired int how many to buy
namerequired string the item name
Example
if not customShopBuy(151, 10) { return 1000 }
customShopBuy("Coal", 10)
customShopBuyable returns shopstock?
customShopBuyable(id: int) -> shopstock?customShopBuyable(name: string) -> shopstock?

The line the shop sells for this item, or none.

The line the shop sells with this name, or none.

ParameterTypeWhat it does
idrequired int the item id
namerequired string the item name
Example
let line = customShopBuyable(151)
let line = customShopBuyable("Coal")
customShopBuying returns list<shopstock>
customShopBuying() -> list<shopstock>

What the shop SELLS to you. Empty while the window is closed.

Example
for line in customShopBuying() { print(line.name) }
customShopCanAfford returns bool
customShopCanAfford(id: int, amount: int) -> bool

True when the currency in hand covers this many. Checks the price and what you are carrying, so it answers false for an item the shop does not sell.

ParameterTypeWhat it does
idrequired int the item id
amountrequired int how many
Example
if customShopCanAfford(151, 10) { customShopBuy(151, 10) }
customShopCurrency returns int
customShopCurrency() -> int

The item id this shop prices in. Usually NOT coins - that is the whole point of a points shop, so never assume 10.

Example
let paidIn = customShopCurrency()
customShopCurrencyName returns string
customShopCurrencyName() -> string

The currency's name, for a printed line worth reading.

Example
print("costs " + customShopCurrencyName())
customShopExists returns bool
customShopExists() -> bool

Whether this client has a custom/points shop at all. False on every server except DragonFire.

Example
if not customShopExists() { stop }
customShopHeld returns int
customShopHeld() -> int

How much of this shop's currency you are carrying.

Example
if customShopHeld() < 500 { stop }
customShopIsOpen returns bool
customShopIsOpen() -> bool

True while the custom shop window is up. Separate from shopIsOpen() - both can be closed, and either can be open without the other.

Example
if not customShopIsOpen() { return 600 }
customShopMissing returns string
customShopMissing() -> string

Which custom-shop hooks are unbound, as one line, or empty when they all are.

Example
print(customShopMissing())
customShopName returns string
customShopName() -> string

What the shop calls itself, or an empty string when the server has not named it.

Example
print(customShopName())
customShopPayout returns int
customShopPayout(id: int) -> int

What the shop pays for one, or -1 when it will not take it.

ParameterTypeWhat it does
idrequired int the item id
Example
if customShopPayout(151) < 5 { stop }
customShopPrice returns int
customShopPrice(id: int) -> int

What one costs, in this shop's currency, or -1 when it does not sell it. -1 rather than 0 so "free" and "not for sale" are never the same answer.

ParameterTypeWhat it does
idrequired int the item id
Example
if customShopPrice(151) > 0 { customShopBuy(151, 1) }
customShopSell does something returns bool
customShopSell(id: int, amount: int) -> boolcustomShopSell(name: string, amount: int) -> bool

Sells to the shop and waits for the bag to lose them. Clamped to what is carried: the sell list says what the shop accepts, not how many you have.

Sells by name and waits for the bag to lose them.

ParameterTypeWhat it does
idrequired int the item id
amountrequired int how many to sell
namerequired string the item name
Example
if not customShopSell(151, 10) { return 1000 }
customShopSell("Coal", 10)
customShopSellable returns shopstock?
customShopSellable(id: int) -> shopstock?

The line the shop accepts for this item, or none.

ParameterTypeWhat it does
idrequired int the item id
Example
if customShopSellable(151) == none { stop }
customShopSelling returns list<shopstock>
customShopSelling() -> list<shopstock>

What the shop BUYS from you. A different set from customShopBuying() - a custom shop need not accept what it sells.

Example
for line in customShopSelling() { print(line.name) }