From 4u2@dec5102.aarhues.dk Date: Wed, 6 Sep 1995 13:26:04 +0100 (WET DST) From: "Erwin S. Andreasen" <4u2@dec5102.aarhues.dk> To: MERC/Envy Mailing List Subject: do_buy: buying multiple items at once Here is some code I made after I got tired of waiting for #10 buy bread to complete :) It will allow players to add an optional count before the item name, to purchase more than one item at a time: e.g. BUY 10 BREAD. The code does check if the character has enough gold for all the items and can carry all the items. Also, you can only buy one of the items that have been sold to the shopkeeper - those items do not have the ITEM_INVENTORY flag set. The code works perfectly with MERC 2.2. I am not sure about the other MUDs' handling of inventory items, so I cannot guarantee any results with them. I don't think ROM's do_buy has been changed, though. Something I'd like to see improved is the message sent when a character buys multiple items. Right now it is : $n buys %d * $p / You buy %d * $p. (where %d is number of items bought if more than 1). It doesn't look that pretty just to add (s) to the object name. In Danish, the equivalent of 'piece' can be used with pretty much any noun, but in English, it sounds quite wrong to say 'two pieces of long sword' :) If you use this code (or any code I have sent to merc-l before) on your MUD, *please* send me a mail with at least your MUD's address, any bugs you found, any features you added or are missing or anything you think is appropriate. I'd like to see who, if anyone uses the stuff I code. To avoid the problem with lines that get wrapped, I decided to UUENCODE the source this time :) The code replace the second part of do_buy, the one that deals with object purchases. The first part, the one that deals with pets remains unchanged. My next assignment will be to expand this to other commands, so you can use PUT 10 BREAD BAG or GIVE 5 BREAD NEWBIE :) Modified part of do_buy follows: