nevermind! (Formerly "Writing description for something...")

Nevermind! I managed to solve it by writing, The description of a person is usually “This is not a description.”

Original post, for posterity:

I’m trying to write a default description for things that don’t have descriptions, so that I can have different ones for animals, people, objects, etc. So I tried:

[code]Hell is a room. “Welcome to Hell.”

Instead of examining a person who doesn’t have a description, say “This is not a description.”

Anna is a person in Hell. The description of Anna is “This is a description.” Hal is a person in Hell.[/code]
But I got the error, “You wrote ‘Instead of examining a person who doesn’t have a description’ , which seems to introduce a rule taking effect only if the action is ‘examining a person who doesn’t have a description’. But that did not make sense as a description of an action. I am unable to place this rule into any rulebook.”

So then I tried,

Instead of examining a person: if the person has a description: say the description; otherwise: say "This is not a description."
And was told, "Problem. In the sentence ‘if the person has a description begin’ , it looks as if you intend ‘person has a description’ to be a condition, but that would mean applying the possession relation (between an object and an object) to kinds of value which do not fit - a texts valued property and an object - so this must be incorrect.
I was trying to match this phrase:

if (person has a description - a condition):
This was what I found out:

person has a description = a condition

Problem. You wrote ‘otherwise’ : but this is an ‘else’ or ‘otherwise’ with no matching ‘if’ (or ‘unless’), which must be wrong."

So even though it has no problem with “The description of X is…” and “say the description”, it doesn’t recognize it if I refer to the description anywhere else? (And on a side note I don’t understand the last “problem”, since my otherwise did too have a matching “if”.)

If I change it to just “Instead of examining a person”, it reads “This is not a description” for Anna, too.

Also for posterity: you can in fact do this with a rule, using the following code.

First carry out examining: if the description of the noun is "": say "Looks good." instead.

Another point – this is one of the easiest ways to get confused in Inform – is that “the person” wouldn’t do what you want, even if the rule had compiled. Inform ignores both “the” and “a” in most cases, so if you write

If the description of the person is ""

Inform treats it as the same as “If the description of a person…”, which will be true if the description of any person is “”. In these cases you need to use “the noun” (or some other appropriate Inform construct – “the second noun” if you’re talking about the second noun, for instance).

As I said, this is one of the most common things that confuses people – and it really tends to cause a lot of head-scratching, because the code looks OK.

Also, the general form you were looking for is “If the noun provides the property description” [for the record, I typed “if the person” before I caught myself]. See section 4.8. However, that won’t work in this case (I don’t think), because every thing is provided with the default description “”; the example in section 4.8 shows you the kind of case where that does work.

An empty text can be described by the adjective “empty.” In other words:

if the description of the noun is empty:

will do what you want.

Here’s another addition perhaps to the idea of design gotchas that should be written down. I see so many forum threads that say “this often causes confusion” or “don’t worry, this part of Inform always causes a little confusion.”

Why is this stuff not gathered together in some place? I’d perhaps recommend a sticky thread – Common Inform 7 Confusions or something – that can be updated maybe only some people to make sure there’s consistency of format and information. Maybe then such a thread could be referenced by whomever tries to write the Inform 7 manual so that it can actually contain information to help wiht material that is often confusing. (Or maybe it can serve as input into how to make design decisions that avoid things that are confusing.)

I have lots of examples that I’ve found in the forum threads and I’d be happy to contribute.

This is a terrific idea!

I’d be happy to sticky the post if you put something together.