Up to Main Index Up to Journal for March, 2024 JOURNAL FOR MONDAY 25TH MARCH, 2024 ______________________________________________________________________________ SUBJECT: Buying! Selling! Best prices here! DATE: Mon 25 Mar 21:11:09 GMT 2024 TL;DR New BUY/SELL commands and traders out on public dev branch. This weekend I got up and went to my desk with the explicit purpose of being able to buy and sell items in WolfMUD. Nothing fancy, just something working. I first got rid of all the cruft accumulating from previous experiments. Next task, money and currency. Nothing clever, WolfMUD has ‘coin’. You can have no coin, 1 coin, 99 coin or some coin. For now ‘coin’ can’t be redefined. The INVENTORY command has been updated to show how much coin you have: >INV You currently have: 3 coin a rock > Players have a new field MONEY for the coin being carried. Items that can be bought and sold have a new VALUE field — an integer, the number of coin it is worth. Okay, that’s the basics out of the way. Next task is traders. An NPC can buy items, sell items or both. For an NPC to buy items a new BUYS field has been added. The BUYS field lists aliases. If a BUY alias matches an item’s alias the NPC will buy the item. This is why it’s important to add a group/category aliases to items :) If the BUYS field is defined but no aliases are specified the NPC will buy anything of value. For an NPC to sell items a new TRADES field has been added. The TRADES field lists item references. This is similar to how the INVENTORY field works. An example NPC trader, a little old lady that sells mushrooms and buys anything tagged ALCHEMY: %% Ref: M1 Name: a little old lady Aliases: +OLD:LADY NPC Location: L1 Body: BODY Health: MAXIMUM→10 RESTORE→2 AFTER→1m Gender: FEMALE Armour: 5 OnAction: $ACT sighs. Trades: O1 Buys: ALCHEMY This is a little old lady. The sort everyone wants as their grandmother. %% Ref: O1 Name: a small mushroom Alias: MUSHROOM ALCHEMY Cleanup: AFTER→1S JITTER→0S OnCleanup: A gentle cloud of spoors leaves the mushroom before it blackens, shrivels up and turns to dust. Value: 1 This is a small grey mushroom. Under the cap the gills are a greyish purple. %% Players can now use BUY and SELL commands to interact with traders. The format of the commands are: BUY NPC BUY ITEM… from NPC SELL ITEM… to NPC The BUY and SELL commands both accept multiple items at once. Here is the little old lady in action: >INV You currently have: 3 coin a rock >BUY LADY The little old lady has the following trades available: a small mushroom (1c) >BUY MUSHROOM LADY The little old lady sells you a small mushroom for 1 coin. >INV You currently have: 2 coin a rock a small mushroom >SELL MUSHROOM ROCK LADY The little old lady buys a small mushroom from you for 1 coin. The little old lady is not interested in buying the rock. >INV You currently have: 3 coin a rock > The changes are out on the public dev branch, with some caveats: • This page and the commits in the repository are the only documentation for now in order to get the new features out. • The NPCs and items in the stock zone files have not been updated yet. To play with the new features you need to add BUYS/TRADES to NPCs and VALUE to items. (I’ll try to get updated zone files out soon) • Containers with things in them should NOT BE BOUGHT OR SOLD yet — the value of their content is not included. • There is no buy-back if something is sold accidentally. • Items players already have will be worthless, no VALUE field. • You cannot create a pile of coin. Well you can, but you’d have to sell it to convert it into actual coin a player can spend. For now, create a gem or something that can be sold for the coin :| • The changes should be considered EXPERIMENTAL. There are probably more issues and bugs, if you find any let me know: diddymus@wolfmud.org There is still more work to be done with traders, this is just the basics :) Limits should be set for the value of items a trader will buy. Our little old lady is unlikely to be able to afford to buy a rare fungi for 1,000,000 coin. Likewise an up-market jeweller is not going to want to purchase a tiny gem for 1 coin :/ Players need an appraisal command to find out, roughly, what an item is worth. Latter on player skills could make the appraisal more accurate… Vendors should also be able to mark-up or mark-down items. An alchemist will probably pay more for the same fungi than a cook would — although a master chef may recognise its worth. Player trading needs adding. I’m thinking maybe add an NPC broker? You place an item for a specified value with the broker and other players can buy the items from the broker. Needs more thought. I’ll sort out updating the stock zones next — turn NPCs shop owners into traders and give all items values. Then the documentation, followed by the outstanding features. After that I think we will need a proper release :) -- Diddymus Up to Main Index Up to Journal for March, 2024