Things players consume, and the merchants who sell them.
Build an edible from #90 BaseEdible and the eat
command works on it immediately — you write no code at all. What you set are
properties describing how it behaves as it is eaten.
> @make #90 = apple
> @set apple.uses = 3
> @set apple.effects = [('intoxicate', 2, 60)]| Property | Meaning |
|---|---|
uses | How many bites it takes. The item is destroyed on the last one. |
effects | Effects applied as it is eaten, as a list of (name, times, interval). |
effect_chance | Percentage chance the effects apply at all. Defaults to always. |
effects_per_bite | Whether effects land on every bite, or only the last one. |
finish / ofinish | What the eater, and everyone else, sees when it is finished. |
eemits | The messages for each bite — to the eater and to the room. |
When a player types eat apple, the shared eat command
calls the eat_ exception that
#90 provides. That is where the counting down, the effects and the
messages happen. If you want one particular pie to do something unusual, give
that pie its own eat_.
Drink works the same way, from #91 BaseDrinkable, with one
difference worth understanding: a drink is a liquid inside a
container. The liquid is the thing built from #91; the cup
or bottle holding it is built from #28 CupContainer.
a shot glass ← #28 CupContainer, what the player holds
└── fire whiskey ← #91 BaseDrinkable, what they actually drink
That separation is what lets the same whiskey be sold by the glass, the bottle
or the case, and what lets an empty glass still be an object. The liquid carries
the same properties as food — uses, effects,
finish — and drink calls its drink_
exception.
A glass of whiskey is called "a shot glass", never "a shot glass of fire
whiskey". Names are what players type at, so putting the contents in the
name makes drink whiskey match the glass instead of the
liquid. Players see what is in it with look in glass.
A merchant turns a room into a shop. The key idea is unexpected and worth stating plainly: the merchant is a price book, not a person. It has no location and nobody can see it. The shopkeeper players talk to is an entry in the merchant's list of speech, not a walking object.
A room becomes a shop by pointing at one. Rooms do not start with a
merchant property, so the first time you must add it
rather than set it:
> @adprop here.merchant = #250
Property 'merchant' added to #204:Test Tavern = '#250'
@set changes a property that already exists; @adprop
creates one. Using @set here answers
merchant doesn't exist on #204, and the shop then reports
There is no one to buy from here.
Buying is a two-step conversation, which gives players a chance to hear the price before committing:
| Player types | What happens |
|---|---|
buy whiskey | The shop finds the item in its stock and quotes a price. Nothing changes hands. |
offer | Pays the asking price. The shop checks their coin and their free hands, mints a fresh copy of the item into their hand, and takes the money. |
offer 5 silver | Names a specific bid. Below the asking price it is refused. |
Stock is never depleted, because nothing is taken off a shelf — each sale mints a new copy from the item the merchant holds as its template. A tavern does not run out of whiskey unless you decide it should.
A bar could stock a glass of whiskey, a bottle of whiskey and a case of whiskey as three separate items. It is better to stock the whiskey once and let the merchant know which vessels it can be served in — each with a size multiplier — so the price follows the measure:
> buy whiskey
"That'll be two silver," she says.
> buy bottle of whiskey
"A bottle? Ten silver."The sale then mints the vessel, pours the liquid into it, and names it correctly — one entry in the price book covering every measure you sell. A whole purchase, start to finish:
> buy rum
A burly barkeep says, "Lessee 'ere, a tankard of spiced rum costs 20 plats.
Ye want one?" If you would like to purchase a tankard of spiced rum make an 'offer'.
> offer
> inventory
You have a tankard in your right hand.
> drink tankard
You take a drink of spiced rum from a tankard.The tankard did not exist a moment earlier, and the twenty plats have gone from the buyer's purse.
A shop writes to several properties on the buyer — what they have
haggled for, what is in their hands, their money. A character missing any
of them fails with Permission denied: cannot create 'pending_buy'
or similar, part-way through a sale. @initchar <character>
adds the full set. Run it on any character that predates your shop, and
on test characters, before you go looking for a bug in the merchant.
Merchants have more moving parts than anything else in this guide: the
price book, the shopkeeper's lines, coin types, vessels and buying by
the case. docs/manual/merchant-guide.md is a step-by-step
build of a working bar, with the complete property reference and a
troubleshooting section. Start there when you build your first
shop.