Right - you just change your existing rule to this:
Rule for writing a paragraph about a person (called X):
say "[X] is here, [rundown for X]."
The reason the say-phrase works this way is that unlike the rest of Inform, the compiler parses phrases EXACTLY as you've defined them, letter-for-letter. If you create a phrase called "To say Tom's rundown," the compiler does not recognize that Tom is the name of a person, it just accepts the word 'Tom's' in that place and no other phrasing (such as 'X's'). You might have well called the phrase "To say Albuquerque rundown" and it would have been no more or less linked to Tom in the eyes of the compiler. If you want a phrase to accept a variable, even if that variable can only ever have one value
, you must
put it in parentheses. Once you've done that, phrase overloading works as it would in other object-oriented languages, so you can define any number of phrases with "To say (someone - particular identifier
):" This defines a say phrase that takes a parameter called "someone" whose value must be particular identifier
It worked (with a little fiddling around to control line breaking), and thanks for the explanation. I'm still in the early stages of grappling with Inform's grammar and syntax, so there's a long way to go. Inform is the first Interactive Fiction language I've learned, and as such completely different from anything I've done before.
My WIP has something similar, but I've put it into an activity called "behavior." I'm not totally happy with it, or I would be working on an extension for it. If you're doing something along the same lines, I might think about an extension more seriously. Maybe start a new thread to discuss this?
Possibly, although as a raw novice I wouldn't be able to contribute much myself. Certainly it would be worth attracting opinions, so if you do start a thread on it pls post a link here to the new thread.
I would have expected describing details of NPCs to be sought fairly often, in a game where details of the characters are subject to change. An example of what I could be doing with the three characters at the construction site is for one to be randomly selected as the murderer, with the telltale signs to be a torn section of their overalls and a pocket bulge where they've stowed the murder weapon.
matt w wrote:
and "The wrist of the player" rather than "the player's wrist." Inform won't understand "the player's wrist."
I think Matt's identified the problem, but I'm not sure if this is the right solution. You need to specify the player's wrist in a way the compiler will understand. If you say:
A wrist is a part of every persion
...the compiler will create one wrist for every person, and it will create a name for each wrist using a specific pattern. For non-player objects, that pattern is "object name
's wrist." That means if you have an NPC named "Henry David Thoreau," the compiler will create a wrist called "Henry David Thoreau's wrist." You can refer to that wrist in your code as "Thoreau's wrist" or "Henry David wrist," but not
as "Henry David's wrist," because the word "David's" is not part of the name that the compiler created. Similarly, parts of the "yourself" object will be called "your wrist," etc. and "the player's wrist" and "the wrist of the player" will not match, because "of" and "player" and "player's" are not part of the official name.
This one is still giving me a headache. I've tried the index and showme command. Nothing appears about wrists in the index, but the Showme command identifies them as:
">showme my wrists
your Wrists - Wrists"
Having learned this I've changed the command to:
Does the player mean doing something with your wrists: it is very unlikely.
This successfully compiles, but unfortunately it appears not to have any effect on gameplay:
Which do you mean, your Wrists
, Tommy's Wrists, Richard's Wrists or Gertrude's Wrists?"
There's a rather brute-force solution that I found while working on something else.
Remove your Wrists from play
Not ideal for all situations, but it's one option. This came about while I was getting ahead of myself and trying out ideas for a furry
Interactive Fiction game. With different species having different body parts the only way I found to achieve this was to say that all body parts are a part of a person and then to remove from play the incorrect ones.
Claws are a part of every person. Hooves are a part of every person.
When play begins: Remove Mr Ed's Claws from play. Remove Shere Khan's hooves from play. [Etc.]
A question that might possibly lead to a solution (or maybe more problems): When there are pairs of body parts, what's the correct way to create them?
Wrists are a part of every person.
A left wrist is a part of every person. A right wrist is a part of every person. (This produced a compilation error).
Two wrists are a part of every person. (This was successfully compiled, but then I couldn't apply the "Remove your Wrists from play" and in gameplay it became impossible to perform actions on anyone's wrists because Inform could no longer distinguish one wrist from another).