intfiction.org

The Interactive Fiction Community Forum
It is currently Sat May 18, 2013 9:45 pm

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 10 posts ] 
Author Message
PostPosted: Fri Mar 30, 2012 2:45 am 
Offline
User avatar

Joined: Sat Sep 04, 2010 6:17 am
Posts: 20
Location: Helsinki/Finland
Hi

I'm having a small problem with matching strings with ask/tell types of situations. I have a conversation topics set up thusly:

Code:
Understand "dog/hound/mutt" as "[dog]".

After asking the man about "[dog]":
       say "A fine hound, that.".


The problem I'm having is the article "the". I can't seem to figure out how to make both "ask man about dog" and "ask man about the dog" match. I've tried matching the string "the" and cutting it in ask/tell situations, but apparently I haven't had the command right.

Any help here? And yes, I'm aware of Eric Eve's great conversation extensions, but this is a largish conversation tree I don't have the time to convert to using them at this point :)

_________________
Janos
Vornasblogi: Gaming, diving & urban exploration


Top
 Profile Send private message  
 
PostPosted: Fri Mar 30, 2012 4:19 am 
Offline
User avatar

Joined: Thu Nov 04, 2010 6:30 am
Posts: 984
Location: Gothenburg, Sweden
I suppose the safe but tedious way would be this:
Code:
Understand "dog/hound/mutt" or "the dog/hound/mutt" as "[dog]".
Understand "cat/kitten/pussycat" or "the cat/kitten/pussycat" as "[cat]".
etc.
Or while you're at it:
Code:
Understand "a/an/the/some/my/his/her/its/their/this/that/these/those" as "[the]".
Understand "dog/hound/mutt" or "[the] dog/hound/mutt" as "[dog]".
Understand "cat/kitten/pussycat" or "[the] cat/kitten/pussycat" as "[cat]".
etc.

_________________
Man ska inte tro allt man tänker.


Last edited by Felix Larsson on Fri Mar 30, 2012 5:56 am, edited 1 time in total.

Top
 Profile Send private message  
 
PostPosted: Fri Mar 30, 2012 4:34 am 
Offline
User avatar

Joined: Sat Sep 04, 2010 6:17 am
Posts: 20
Location: Helsinki/Finland
Yep, oh dear - I hoped there was some easier way that I had just overlooked.

_________________
Janos
Vornasblogi: Gaming, diving & urban exploration


Top
 Profile Send private message  
 
PostPosted: Fri Mar 30, 2012 8:21 am 
Offline

Joined: Tue Dec 25, 2007 10:06 am
Posts: 887
An easier way would be to add new grammar lines for the actions:

Code:
Understand "ask [someone] about the [text]" as asking it about.
Understand "tell [someone] about the [text]" as telling it about.

_________________
Vorple UI libraryBeta testing siteBlog


Top
 Profile Send private message  
 
PostPosted: Fri Mar 30, 2012 8:29 am 
Offline
User avatar

Joined: Sat Sep 04, 2010 6:17 am
Posts: 20
Location: Helsinki/Finland
Juhana wrote:
An easier way would be to add new grammar lines for the actions:

Code:
Understand "ask [someone] about the [text]" as asking it about.
Understand "tell [someone] about the [text]" as telling it about.


!

And that's exactly the kind of elegant way I've been racking my brain to find. Cheers! Sometimes you just get so blind to the code :)

_________________
Janos
Vornasblogi: Gaming, diving & urban exploration


Top
 Profile Send private message  
 
PostPosted: Fri Mar 30, 2012 8:42 am 
Offline
User avatar

Joined: Sat Sep 04, 2010 6:17 am
Posts: 20
Location: Helsinki/Finland
Okay, this actually is a little bit tangential to the issue, but something I've been wondering - I know how to use the Understand "xxx" as "[yyy]" types of substitutions, but this is not something I would've come up with intuitively when studying the language, ie. I don't understand how that actually works codewise.

I mean, I've thought "blabla [yaddayadda]" is something that essentially calls a function yaddayadda that does something: either a "to say yadda yadda" or something that's built in, like making a new paragraph. I don't really get how the Understand-matching fits to that, though. Is it a procedure? What kinds of things can you attach to a [yaddayadda]?

If there's someone who doesn't mind explaining this in technical terms I'd be much obliged!

_________________
Janos
Vornasblogi: Gaming, diving & urban exploration


Top
 Profile Send private message  
 
PostPosted: Fri Mar 30, 2012 9:24 am 
Offline
User avatar

Joined: Thu Nov 04, 2010 6:30 am
Posts: 984
Location: Gothenburg, Sweden
A line such as 'Understand "dog/hound/mutt" as "[dog]".' translates into a 'General Parsing Routine' that matches words from the player's command with the relevant words in the game's dictionary.
This routine is called by rules that contain the "[dog]" token.

A line such as 'To say yadda: say "yaddayaddayadda".' translates into a routine that prints the relevant text.
That routine is called by the phrase 'say yadda' for which ' "…[yadda]…" ' is just syntactic sugar.

_________________
Man ska inte tro allt man tänker.


Top
 Profile Send private message  
 
PostPosted: Fri Mar 30, 2012 11:55 am 
Offline

Joined: Tue Nov 08, 2011 8:11 am
Posts: 79
Maybe I'm missing something but couldn't you just specify the article "the dog is an animal" to clear this up?


Top
 Profile Send private message  
 
PostPosted: Fri Mar 30, 2012 1:17 pm 
Offline
User avatar

Joined: Thu Nov 04, 2010 6:30 am
Posts: 984
Location: Gothenburg, Sweden
The problem is that when the player writes 'Ask Guy about the dog', the parser never tries to match the words "the dog" against the dog or any other object in the game. (This is to let you ask people about things that are not in the game at all.) Instead, the rule 'after asking the man about dog' tries to match the words "the dog" from the player's input literally against the given topic 'dog' from the rule; and since "the dog" looks different from mere 'dog', it decides there is no match.

_________________
Man ska inte tro allt man tänker.


Top
 Profile Send private message  
 
PostPosted: Fri Mar 30, 2012 1:50 pm 
Offline

Joined: Sun Mar 01, 2009 8:02 pm
Posts: 902
Felix wrote:
The problem is that when the player writes 'Ask Guy about the dog', the parser never tries to match the words "the dog" against the dog or any other object in the game. (This is to let you ask people about things that are not in the game at all.)

Since nobody else in this thread has mentioned it, I should point out that if you use Eric Eve's conversation extensions, this whole problem just dissolves. If you use these extensions, you CAN ask or tell about in-game objects, and the parser operates normally with respect to adding articles to nouns.


Top
 Profile Send private message  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: Google [Bot] and 1 guest


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