Beverage Service

Example 122

A potion that the player can drink.

Some kinds of game objects – food, for instance – can only sensibly be used once, and should then be destroyed. The EAT command already implements this, but suppose we also had a category of drinkable potions:

"Beverage Service"
A potion is a kind of thing. The sparkly blue potion is a potion carried by the player.
Level 3 is a room.
Instead of drinking a potion (called the drink):
   now the drink is nowhere;
   say "You quaff [the drink]. It goes down beautifully."
Test me with "drink sparkly / i".
Test me with "drink sparkly / i".
Level 3

>(Testing.)

>[1] drink sparkly
You quaff the sparkly blue potion. It goes down beautifully.

>[2] i
You are carrying nothing.