# Pour some drink from bottle to glass

Hello,

I am trying to come up with a rule that allows the player to pour some beverage from a bottle into a glass, without actually transporting the whole amount of the liquid from one container to the other.

I suppose that it requires a way of duplicating the beverage thing, so that we end up with one in each container.

(The problem, thus, can be “how do we duplicate a thing?”)

After defining a beverage as a kind of thing that can be consumed etc. and a glass as a kind of container, I was thinking along the lines of…

```Instead of inserting a beverage (called the drink) into a glass (called the vessel): let D be ***a beverage of the same kind as the drink***; say "You pour some of [the drink] into [the vessel]."; now the vessel contains D. ```
but I don’t know how to write it properly. Any help please?

Thanks,
Giannis

So this isn’t quite an answer to your question, but my recommendation would be—don’t use individual items for this, use kinds of value. Measured Liquid by Emily Short is a ready-made way to do that.

Yes, liquids are notoriously difficult to handle, and there isn’t a built-in way of duplicating a thing–in general you have to create everything you want in advance, and move them on-stage as necessary. Which might be easier than implementing the liquid as a separate thing. Here’s one way of doing it (for some reason, I had to say “instead of drinking the glass when the glass is empty” etc. rather than the more straightforward “instead of drinking the empty glass”):

[code]Bar is a room. A pitcher of beer is in the bar. The description is “The pitchers here are so enormous that you could hardly drain them.”

A glass is in the bar. The glass can be empty or full. The glass is empty. The description of the glass is “The glass is [if the glass is empty]empty[otherwise]full of beer[end if].”

Understand “beer” or “of beer” as the glass when the glass is full. Understand “empty” as the glass when the glass is empty. Understand “full” as the glass when the glass is full.

After printing the name of the glass when the glass is full: say " of beer".

Instead of inserting the pitcher of beer into the glass when the glass is empty: [this takes care of “put beer in glass”; you’d want to handle more synonyms]
say “You pour beer into the glass.”;
now the glass is full.

Instead of inserting the pitcher of beer into the glass when the glass is full:
say “The glass is already full.”

Instead of drinking the glass when the glass is empty:
say “The glass is empty.”

Instead of drinking the glass when the glass is full:
say “You drain the glass.”;
now the glass is empty.

say “You have to put the beer in the glass before you drink it.”

Does the player mean drinking the glass: it is very likely. [so “drink beer” goes to the glass][/code]

Another way of doing it would be to have a full-glass object out of play (or more, if necessary) and swap the full-glass object in for the empty glass when the glass gets filled. Example 378, “Pizza Prince,” gives you a way of making a dispenser like that. And if you don’t want the pitcher to be bottomless, you could keep track of how many times you’ve filled the glass from it and block filling the glass once the pitcher reaches its max count.

So, Daniel, by “kinds of value” you mean make the glass “empty” and “full,” like Matt suggests?
Thank you, I don’t know if I need a whole extension -I think I get the gist of Matt’s code and I think I can generalise it to serve several drinks.

Exactly! Or more specifically having one value indicating what liquid is in the glass, and another value indicating how much of it there is. I suggest Measured Liquid because it handles all the edge cases very well; you might look at it for inspiration even if you don’t use it.

Thank you! I won’t say I’m not tempted. Probably a bit overwhelmed by reading the doc of a whole extension. But I may as well go for it…

Oh, and thanks, Matt, of course!!!