Text Properties of Classes

I keep wanting to define classes of objects with some default text that refers to the object in some way, and I keep stumbling.

First Issue:

I might want to define a property which should default to having the value of some other property. I’ve tried stuff like:

A thing has some text called the secret name. The secret name is usually the printed name.

But the compiler always complains. In this case, I basically want the property to be the same as the printed name, unless I say otherwise on a specific instance of the class.

Second Issue:

I might want to define a property that is some text including the object’s name. E.g. I might want every thing to have an “eating description” which should default to “You swallow whole.”

I don’t even know where to start with this one. Printed name gives me the name of the object, but not the article (in this case “the”, but possibly “a” or even nothing depending on what I’m doing). Adding [indefinite article] doesn’t result in any new output. [definite article] won’t compile.

It seems to me that the following fits the Inform syntax:

A thing has some text called the eating description. The eating description of a thing (called the whatsit) is usually, "I eat the [whatsit]."

But that doesn’t compile.

I also view this as a fundamental feature that the system ought to have. There is a uservoice request here:

inform7.uservoice.com/forums/573 … -to-be-def

Like most nitty-gritty programming requests, unfortunately, it has garnered very few votes. Until everyone starts to think like us, you’ll need to initialize these in a loop at the beginning of the game. (*Oops–Ron’s post below reminds me that you were asking specifically about a text property–in that case, you can use bracketed text to refer to the current state of another property; but that isn’t a solution that’s generalizable to other types.)

Try “[the item described]”.

–Erik

maybe… A thing has some text called the secret name. The secret name is usually "[the printed name of the item described]". A thing has some text called the eating description. The eating description is usually "I eat the [printed name of the item described]."

Yuck.

Thank you! I knew there had to be a way to do this, but I was damned if I could figure out how to find it.

Oooh, yeah! I remember I stumbled onto that solution myself, although I suppose it only works for text… (Which, admittedly, is what my thread title says.)

My second question is the one that moved me to post, but I thought I’d throw the first one in while I was at it. I’ve only encountered the issue with text so far, but I think it would be useful to be able to do it with other values as well. Sometimes you just want an attribute that is usually some other attribute, but may differ in specific instances/subclasses.

I usually do that with To Decide phrase. I have a feeling that rulebooks or maybe activities can return objects, but I’ve never tried it.
A rulebook in this situation would be a flexible way to return a default value in the general case while being overridden easily.