Overwriting descriptions

Hi folks,
I got a fluid container as in the “Lemonade” example of the I7 documentation. How do I overwrite its description if the container is in a certain room?
Thanks and kind regards,
Grues

Do you mean something like:

The description is “[if the location is room1]Specific description[otherwise]General description[end if].”

If the item description already has a bunch of embedded if statements that might make this approach tough to manage, but hopefully this is a reasonable starting point!

There are lots of ways; which is best depends on what you want to do, but is partly a matter of taste.

The most straightforward:

The description of the red herring is "Never mind, it's just a red herring."
Instead of examining the red herring when the location is Room of Mysteries:
       say "The herring winks back at you mockingly."

Another way (this is Mike’s suggestion above):

The description of the red herring is "[if the location is the Room of Mysteries]The herring winks back at you mockingly[else]Never mind, it's just a red herring[end if]."

And another:

The description of the red herring is "[herring text]."
To say herring text:
        if the location is the Room of Mysteries:
                say "The herring winks back at you mockingly";
        otherwise:
                say "Never mind, it's just a red herring".

Note the tricks with the punctuation; in some cases it helps Inform to get the spacing right if the description ends with an explicit full stop (or exclamation mark),

Mike answered the question you asked but the Lemonade example renders the actual description property of the example fluid container irrelevant. So what are the places where you want different output? The examine command? Elsewhere?

2 Likes

Just the examine command. I used a normal "Check examining when is in : Say “” instead, but to no avail.

Instead rules run before check rules and they (by default) stop the action, and the example had an instead rule, so your check rule was never reached.

You could replace the Instead rule with:

Carry out examining a fluid container:
  if the noun is empty, say "You catch just a hint of [the liquid of the noun] at the bottom.";
  else say "[The noun] contains [current volume of the noun in rough terms] of [liquid of the noun].";
  now examine text printed is true.

and then for your exceptional case:

Carry out examining the pitcher when the porch encloses the pitcher:
  say "foo.";
  stop the action; [if you don't stop the action here, add "now examine text printed is true"]
2 Likes

That did the trick, thanks a lot!