how to make something drinkable.

i know how to make things edible…
but drinkable isnt that simple… and the recipe book doesnt help…
i thought making things drinking material would be as easy.

i thought i just had to type The something is drinkable or something

See §10.2. Liquids in the Inform 7 recipe book.

The example Thirst shows how to write a custom response rule for drinking from the waterskin (the Instead rule). For a simple drink response in your story, you can cut the “when the waterskin is empty” condition.

"Thirst" 

The player carries a waterskin. The waterskin can be full, partly drained, or empty. The waterskin is full. Understand "water" as the waterskin. 

Instead of drinking the waterskin when the waterskin is empty:
        say "There is no water left."
... 

ok ill try it out .

Whenever I try to let the player drink something, Inform 7 says that it doesn’t recognize the verb “to drink.” Apparently that verb is in the database already, but I have to unblock the drinking rule. When I typed in the unblock command like the Index says, Inform 7 doesn’t recognize that either. I’ll try the solution that was posted previously, but I really don’t think it applies to my situation

Can you post your code? The standard I7 response to drinking anything is “There’s nothing suitable to drink here.”

Removing the rule that supplies this message will not, by itself, make anything drinkable. You still have to write you own rules about what is drinkable and what is not, what happens when you try to drink something, what happens when you try to drink something that’s not drinkable, etc.

If the issue is that you tried to use the verb “to drink” in a text substitution, like this:

Report an actor drinking something: say "[The actor] [drink] [the noun]. Refreshing."

then you have to explicitly tell Inform that you’re going to use “drink” as a verb, like this:

To drink is a verb.

Once you’ve got that, then Inform will automatically conjugate it for you–it should understand that the past tense of “drink” is “drank” and like that, if you need to do that. That’s the sense in which the verb is in the database. But Inform won’t understand verbs that you want to use in text substitutions unless you tell it that you’re going to use them as verbs.

(Apologies if this isn’t the problem you were having, but it kind of sounded like it. Also I haven’t actually tried this code out so there’s a real possibility that it’s mistaken somehow.)

Thanks for the quick responses!
code 3.PNG
code 2.PNG
code.PNG

Well, let’s go step by step through a basic example of how you might do this.

First, you have to code a way for the game to know what’s drinkable and what’s not.

[code]A thing can be drinkable. A thing is usually not drinkable.

The coffee is drinkable.[/code]

Next, you need to create an action for drinking. (NB: Don’t get confused between actions and verbs. An “action” is something that the player can try to do in the game. A “verb” is a word that you can teach Inform to print in different ways depending on the game’s POV and tense. It’s confusing. Just remember that right now we’re worried about actions.)

Fortunately, Inform already has an action for drinking built in. Go to the actions tab of the index and click on the drinking action. You’ll see it has exactly one rule: the “block drinking rule”. This rule produces the response “There’s nothing suitable to drink here,” regardless of what you are trying to drink. You want to create your own rules for drinking, so you’ll want to get rid of the block drinking rule.

The block drinking rule is not listed in any rulebook.

Now you’ll want to figure out how drinking should work in your game. At a minimum, you’ll probably want to check to see whether the object is drinkable (and stop the action if it’s not), remove the drunk object from the game, and print a message to the player.

[code]Check drinking:
if the noun is not drinkable:
say “[The noun] [are] not drinkable.”;
stop.

Carry out drinking:
remove the noun from play.

Report drinking:
say “You slurp down [the noun]. Refreshing!”[/code]

You can then write instead and after rules to handle specific cases, if necessary.

[code]Instead of drinking the drain cleaner:
say “Not a good idea.”
[this stops the action before it gets to the carry out rules, so the drain cleaner never gets drunk]

After drinking the slightly spoiled milk:
say “Ugh. You’re probably going to regret that in about an hour.”
[this runs through the carry out rules but supersedes the report rules, so the milk gets drunk but produces a different message][/code]

Read up sections 4.7 (New either/or properties), 7.2-7.5 (Instead, Before, After), 12.9 (Check, carry out, report), and 19.4 (Listing rules explicitly) for more details.

1 Like

And about on the errors you got: “I can’t find a verb that I know how to deal with” is one Inform’s basic ways of telling you that a line was not valid Inform code. It’s not very informative–it basically says that the the Inform compiler didn’t know where to start with what you typed.

The first one is pretty simple: You left out a space, so you have “asthe” where it needs to be “as the.”

For the second one, Mike covered this, but you got confused by the name of the rule. In the index, the rule name is written in red, so the name of the rule is “the block drinking rule.” (Because it’s the rule that stops the player from drinking anything they might want to drink.) It’s not that there’s a “drinking rule” that you can block. So when you wrote “block drinking rule” Inform just saw the name of a rule on its own line and didn’t know what it was supposed to do with it.

If you want to go to the index and remove a rule, you can just click on the “unlist” icon next to the name of the rule. This will paste one of the lines of code that Mike gave you into your project:

The block drinking rule is not listed in any rulebook.

(Make sure the cursor is on a blank line when you do this or it’ll wind up weird!)

And then you have to do the rest of the stuff Mike talked about–as he said, you should read up those sections of the documentation.

Thanks, This looks like it will solve my problem too.