Author Topic: Parser Syntax Problem  (Read 1159 times)

0 Members and 1 Guest are viewing this topic.

Offline Doan Sephim

Parser Syntax Problem
« on: March 30, 2020, 12:48:16 PM »
I'm trying to get the parser to accept "pry open with shovel" but can't seem to get it right.

The best I have is
Code: [Select]
(if(Said('[pry<open]/shovel'))This responds to "pry open shovel" as you might imagine, but I cannot seem to get "with" to work at all.

EDIT: apologies for studio script. BA is an old project, and I'm not interested in converting it all over to sierra script. BA2 on the other hand will not have this issue.


Artificial Intelligence Competition

Offline Doan Sephim

Re: Parser Syntax Problem
« Reply #1 on: March 30, 2020, 11:15:55 PM »
It looks like the problem is the parser is seeing "shovel" as the direct object of "pry open" and therefore not allowing any prepositions (although I have "with" assigned as a "subordination" in the vocab).
Code: [Select]
(if(Said([pry<open]/grave/shovel'))This code works for "pry open grave with shovel" I think because it sees "grave" is the direct object of pry open, allowing me to add "with shovel"

That said, I would really like to give a response for "pry open with shovel" as it is a reasonable thing a person might type. I've tried different syntaxes (syntaces??) and changed the type of word for "with" to try to catch possible work arounds, but am coming up empty.

Gumby, if you're out there, I know you have done a lot of work figuring out the parser...any thoughts?

Offline Kawa

Re: Parser Syntax Problem
« Reply #2 on: March 31, 2020, 05:46:46 AM »
NLPDOC.PRN has the following example phrases:
Code: [Select]
"hit the small tree"       'hit/tree<small'
                           'hit/tree[<small]'
                           'hit[/tree[<small]]
                           'hit'

"hit the small green tree with the ax"
                           'hit/tree/ax'
                           'hit/tree<(green<small)/ax<with'

"burn it" = "burn tree" after last sentence
                           'burn/tree'

Offline Doan Sephim

Re: Parser Syntax Problem
« Reply #3 on: March 31, 2020, 09:01:24 AM »
Thanks Kawa. The examples you provided all have direct objects. The parser command I'm trying to account for is a statement with only an implied object, which is why this one is proving difficult for me.

"pry open with shovel" is implying the game knows the "what" that you are trying to "pry open"

In a perfect world, anyone who plays a game like this would know, "of course I need to plug in the object of the 'pry open' action," but in reality, I want to be able to program the game to either a) do what they are implying or b) ask them exactly what they are trying to pry open.
« Last Edit: March 31, 2020, 09:30:13 AM by Doan Sephim »
Artificial Intelligence Competition

Offline Doan Sephim

Re: Parser Syntax Problem
« Reply #4 on: March 31, 2020, 12:50:22 PM »
So, I think I have a reasonable solution.

Set up all the correct statements like before

After them insert:
Code: [Select]
(if(Said('[pry<open]'))
            Print("How would you like to do that?")
        )
This will pick up anything with the phrase "pry open" so long as it's not in the list of things that worked in the code above it like "pry open grave with sword."

Sure, it will also trigger for "pry open nose with finger" but that's a sacrifice I'm willing to make  ;D

Offline lskovlun

Re: Parser Syntax Problem
« Reply #5 on: March 31, 2020, 03:18:01 PM »
"pry open nose with finger"
aka 'pick / nose' . You could catch that case with some sort of allusion to QfG1 :D

Offline Doan Sephim

Re: Parser Syntax Problem
« Reply #6 on: March 31, 2020, 03:30:33 PM »
"pry open nose with finger"
aka 'pick / nose' . You could catch that case with some sort of allusion to QfG1 :D
Ah yes! A great way to increase lock picking skills

Offline Kawa

Re: Parser Syntax Problem
« Reply #7 on: April 01, 2020, 12:35:33 PM »
Congratulations. Your nose is now open.

Offline troflip

Re: Parser Syntax Problem
« Reply #8 on: April 02, 2020, 05:49:07 PM »
Can't you use something like this? e.g. leave the middle term blank. 
Code: [Select]
'pry<open//shovel'
(just guessing, it's been a while)
Check out my website: http://icefallgames.com
Groundhog Day Competition

Offline Doan Sephim

Re: Parser Syntax Problem
« Reply #9 on: April 02, 2020, 11:18:48 PM »
Can't you use something like this? e.g. leave the middle term blank. 
Code: [Select]
'pry<open//shovel'
(just guessing, it's been a while)
Clever idea...and it works too! Thanks

Offline gumby

Re: Parser Syntax Problem
« Reply #10 on: April 03, 2020, 08:16:30 PM »
Glad you got this working.  For my own edification I'd like to investigate further, but so far I'm not getting the expected results either.  How do you have these words defined in your vocab?
In the Great Underground Empire (Zork port in development)
Winter Break 2012 Rope Prop Competition

Offline Doan Sephim

Re: Parser Syntax Problem
« Reply #11 on: April 03, 2020, 08:58:17 PM »
Glad you got this working.  For my own edification I'd like to investigate further, but so far I'm not getting the expected results either.  How do you have these words defined in your vocab?
Troflip posted a working solution if you want to take a look above

Offline Kawa

Re: Parser Syntax Problem
« Reply #12 on: April 04, 2020, 04:47:57 AM »
Yes but what are these words, class-wise?

Offline Doan Sephim

Re: Parser Syntax Problem
« Reply #13 on: April 04, 2020, 09:18:04 AM »
Yes but what are these words, class-wise?
pry = imperative verb, qualifying adjective
open = same as pry
with = subordination
shovel = noun, imperitive verb

Offline gumby

Re: Parser Syntax Problem
« Reply #14 on: April 04, 2020, 11:25:15 AM »
I played around a bit with this, the best I could come up with was this:
Code: [Select]
        (if(Said('[pry<open]/grave/[shovel<with]'))
            Print("Opened.")
)

But I couldn't get it to work with 'pry open with shovel' without dropping the middle segment entirely as in Troflip's solution:
Code: [Select]
        (if(Said('[pry<open]//[shovel<with]'))
            Print("Opened.")
)

This seems like it should work making 'grave' optional, but doesn't:
Code: [Select]
        (if(Said('[pry<open]/[grave]/[shovel<with]'))
            Print("Opened.")
)

In the Great Underground Empire (Zork port in development)
Winter Break 2012 Rope Prop Competition


SMF 2.0.14 | SMF © 2017, Simple Machines
Simple Audio Video Embedder

Page created in 0.122 seconds with 24 queries.