CreateShop
Makes a shop - a title, whether it buys, its purse.
Empty until SetShopItem fills it. sellFactor is the fraction of an item’s catalogue price the shop pays when a
player sells (0.5 = half its worth; 0, the default, = it buys nothing and the screen has no Sell tab). money is
the purse in Groschen it pays out of (nil or a negative number = bottomless); what the players buy fills it. Put it
on an actor with SetActorShop or open it with OpenShop.
Syntax
Section titled “Syntax”CreateShop(title [, sellFactor, money])| Parameter | Type | |
|---|---|---|
title |
string | the screen’s title |
sellFactor |
number | 0 .. 1 (0: buys nothing) (optional) |
money |
number | the purse in Groschen; nil = bottomless (optional) |
Returns
Section titled “Returns”number - the shop’s id; nil when it could not be made
Example
Section titled “Example”local store = CreateShop("General store", 0.5, 500)SetShopItem(store, "torch_weapon", 5) -- unlimited torches at 5 GroschenSetShopItem(store, "arrow_normal", 0.5, 200) -- two hundred arrows at half a GroschenSetShopItem(store, "shortswordBroad", 90, 3)See also
Section titled “See also”SetShopItem · SetActorShop · OpenShop · DestroyShop · the Shops and vendors group of the index
