intfiction.org

The Interactive Fiction Community Forum
It is currently Thu May 23, 2013 1:43 am

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 142 posts ]  Go to page Previous  1 ... 4, 5, 6, 7, 8, 9, 10 ... 15  Next
Author Message
PostPosted: Sat Feb 18, 2012 1:45 am 
Offline

Joined: Wed Jun 23, 2010 6:14 am
Posts: 63
Location: Sydney, Australia
In room descriptions definitely, and also where I'm being lazy with "Look at (person)", IE if the character isn't integral to the story and I'm not creating a separate "Look at" description for them.


Top
 Profile Send private message  
 
PostPosted: Sat Feb 18, 2012 10:54 am 
Offline

Joined: Fri Jul 16, 2010 2:09 pm
Posts: 1950
matt w wrote:
thefoxaroo wrote:
capmikee wrote:
On the rundown issue, you can do this:
Code:
To say rundown for (somebody - Tom):

This will correctly invoke the phrase if you pass a variable that evaluates to Tom. However, I'm not positive that you could write it as you have, with an apostrophe-s and no space.
I'm sorry, I don't comprehend (it probably doesn't help that I made a typo above, "The description of Tom" twice when the 2nd line should have been "The description of Dick"). Could you elaborate on how your recommendation would then be integrated into a rule for printing? That's the piece of code where I was getting an error message.
One issue is that I think you need to say "The rundown of Tom" or "The rundown for Tom" rather than "Tom's rundown,"

Right - you just change your existing rule to this:

Code:
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.

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?

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:

Code:
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.


Top
 Profile Send private message  
 
PostPosted: Sat Feb 18, 2012 11:25 am 
Offline

Joined: Tue Mar 09, 2010 2:34 pm
Posts: 2128
Location: Burlington, VT
You're right, of course. If you want to write a rule that captures the player's wrist, one thing you could do is look at the Index (or showme the player) to find out what Inform is calling the object. Or if you need a more general case (if there's a possibility of switching the player from one person to another) then you might need "a wrist that is part of the player" or "a random wrist that is part of the player" or something like that.


Top
 Profile Send private message  
 
PostPosted: Sat Feb 18, 2012 9:15 pm 
Offline

Joined: Tue Mar 09, 2010 2:34 pm
Posts: 2128
Location: Burlington, VT
How about something like this?

Code:
Rule for writing a paragraph about a person (called X): Say "[X] is here. [rundown of X]".
The description of a person is usually "[rundown of the item described]".
To say rundown of (X - a person): [complicated code goes here]


I haven't tested this, but I think it might work.


Top
 Profile Send private message  
 
PostPosted: Sat Feb 18, 2012 10:30 pm 
Offline

Joined: Wed Jun 23, 2010 6:14 am
Posts: 63
Location: Sydney, Australia
capmikee wrote:
Right - you just change your existing rule to this:
Code:
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.

capmikee wrote:
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.

capmikee wrote:
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:
Code:
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:
Code:
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:
">Examine wrists
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.
Code:
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.
Simplified example:
Code:
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.
or
A left wrist is a part of every person. A right wrist is a part of every person. (This produced a compilation error).
or
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).


Top
 Profile Send private message  
 
PostPosted: Sat Feb 18, 2012 10:55 pm 
Offline

Joined: Tue Mar 09, 2010 2:34 pm
Posts: 2128
Location: Burlington, VT
I think you're hitting one of the annoyances of DTPM rules. As I understand it, they assign a score to every possible match, and if one object comes out with the best score then they pick that object. But if there's a tie, they ask the player to disambiguate every possible match. So in this case, if there's one NPC in the location I think it will automatically examine the NPC's wrists, but if there is more than one NPC it will disambiguate among everyone's wrists.

You could see if the Disambiguation Control extension helps. I don't know any other way to solve the problem.


Top
 Profile Send private message  
 
PostPosted: Sat Feb 18, 2012 11:23 pm 
Offline

Joined: Wed Jun 23, 2010 6:14 am
Posts: 63
Location: Sydney, Australia
Okay that sounds logical.

Not familiar with those terms though. What's DTPM and Disambiguation Control? I couldn't find either of those in the manual.


Top
 Profile Send private message  
 
PostPosted: Sat Feb 18, 2012 11:26 pm 
Offline

Joined: Tue Mar 09, 2010 2:34 pm
Posts: 2128
Location: Burlington, VT
Sorry, DTPM is "does the player mean," and Disambiguation Control is an extension by Jon Ingold found here.


Top
 Profile Send private message  
 
PostPosted: Sat Feb 18, 2012 11:33 pm 
Offline

Joined: Fri Jul 16, 2010 2:09 pm
Posts: 1950
DTPM is short for Does The Player Mean. Disambiguation Control is an extension by Jon Ingold.

I haven't had much luck with Disambiguation Control. It only does certain things, and I can't remember whether removing an item from the match list is one of them.

I spend a lot of time debugging DTPM. Here are some things I keep in mind:

The DTPM rulebook runs once for every possible action that the parser tries to match against the command. In effect, every noun is tried one at a time. And like any other rulebook, DTPM stops running on the first rule that produces a result. So rule order matters. If you have one DTPM that refers to examining and one that refers to body parts, only one of them will apply to examining wrists, and which one depends on the rule order.

So, two super-valuable things to do:

Turn rules on. This will tell you which DTPM, if any, are running. Unfortunately, you won't be able to see what circumstances they're running on. So the second thing is to add this rule:

Code:
First does the player mean: showme the current action.


That will give you a nice "header" for every block of DTPM that runs, ending with the one that made the decision.

If you get really desperate, you can use the "trace" debug command, but that will give you a lot of I6 parser stuff that's hard to decipher.


Top
 Profile Send private message  
 
PostPosted: Sun Feb 19, 2012 12:02 am 
Offline

Joined: Fri Jul 16, 2010 2:09 pm
Posts: 1950
matt w wrote:
I think you're hitting one of the annoyances of DTPM rules. As I understand it, they assign a score to every possible match, and if one object comes out with the best score then they pick that object. But if there's a tie, they ask the player to disambiguate every possible match.

My approach to this problem is to make an extra effort to ensure that only one choice scores high - thus avoiding disambiguation completely. A few specific cases that trigger "it is very likely" are much more powerful than a large number of cases returning "it is very unlikely."

Here, you might want something like:

Code:
Does the player mean doing something with a body part that is part of a dead person: it is very likely.


Top
 Profile Send private message  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 142 posts ]  Go to page Previous  1 ... 4, 5, 6, 7, 8, 9, 10 ... 15  Next

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: Google [Bot], Spoff and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group