Fantasy Worlds Icon

Generic Vending Machine



@create #148 named MyVendingMachine

Description

The vending machine can dispense sodas, chips, candy, or even stamps or other items. The only limit is your imagination.

Uses

The vending machine doesn't have to be a metal box that takes coins and drops chips or sodes. It can be a magic cupboard, or a fish-food dispenser, or an automatic bookshelf. The trick is to think in terms of having a machine or "thing" into which you insert a token, e.g. a coin, a card, a passkey. The result of the "insert" is the "buy" action. Just as in real life, the vending machine's stock can be depleted and must be restocked.

Commands

Insert coins into MyVendingMachine To make a purchase. Selects a random item from the stockroom, dispenses it (using buy_msg and item's description), and deletes the item from the current stock.

Restock MyVendingMachine If you don't feel like waiting for the stockboy to refill the machine. The "stockboy" will refill the vending machine after it has been empty for a time. When the "empty" state occurs, the object sets a timer for the amount of time to wait before refilling itself from the stockroom.

Customizing Your Vending Machine

@edit MyVendingMachine.description

Creates a description which is shown when a player types "look MyVendingMachine".

@edit MyVendingMachine.stockroom

This allows you to change the inventory in your vending machine's stockroom. The stockroom uses one line per item. You can include both the name of the item and a descriptive phrase. Tip: put the proper "article" (a, an, the, some) as the first word of the item's name, e.g. a bag of chips.

When an item is "bought" the vending machine constructs its response by displaying the .buy_msg followed by the stock item's description. Make sure that the two are compatible. In this version, there is only a single .buy_msg.

Setting The Vending Machine's Messages

The following messages may be set to customize your vending machine:

You may also use the editor to enter the message text.

Back


Last Updated: 07 January 2001
This webpage is maintained by Kit Finn (kmfinn@wm.edu)