I6: Parsing Beyond ASK/TELL

Dear all,

the object focus of Inform starts to worry me a little. I’m now trying on simple conversations, and I’d need the parser to deal with some stuff beyond ask and tell. I know this question is very general and probably deals with a rather complicated topic, but -

How can I parse something like “npc, i can help”?

I guess I could check for one word conversation, but how do I deal with several words that aren’t in the dictionary of the game?

Read up on parse_name. This library method allows you to identify any set of words you like, in whatever order or orders you feel the player should use. You can create an invisible topic-type object and put it in scope in the grammar code for your own verb.

However, you DO need the command line to start with a verb. Unfortunately, in the example you gave, ‘npc, i can help’, Inform will parse ‘i’ as ‘inventory’, and that will probably happen before your custom verb gets a shot at it, unless you remove that matching token from the library’s Inventory grammar and then create your own custom action that will re-route ‘i’ to the Inventory command if there are no other tokens in the input.

In this particular case, I think you could also use a before-parsing entry point of some sort to transmute that string into ‘offer to help npc’. That would be easier to code, as the verb ‘offer to help’ should be a bit easier to set up.

My I6 is rusty, so my apologies for not remembering the name of the before-parsing entry point. But as mentioned in the DM4, Kathleen Fischer (wonder whatever happened to her…) once said, “parse_name is your friend.” And indeed it is.

I think some authors duck out of this sort of situation by responding to unparsed Orders and Ask/Tell commands with a suggestion to use ask/tell instead. In this case, “tell npc about help” might be the best thing for the parser to understand, or “tell npc about the-subject-i-can-help-with” or even “offer help to npc.” As long as your error messages point the player to the right syntax, I think you’ll be ok.

Hmhm. Started to read the DM4 about parse_name. Got a question on that.

DM4 says “Inform creates the dictionary of a story file by taking all the name words of objects, all the verbs and prepositions from grammar lines, and all the words used in constants like ‘frog’ written in the source code, and then sorting these into alphabetical order.”
And it says “and the more words, the better the match is considered to be. Thus fried green tomato'' is a better match thanfried tomato’’ or green tomato'' but all three are considered to match. On the other hand, so isfried green’’, and ‘`green green tomato green fried green’’ is considered a very good match indeed.”.

Now, could that mean that if I define a dummy object with name ‘i’ ‘can’ ‘help’, I’d have a good chance to have the parser find this object when going through “npc, i can help”? Is that an approach worth further thinking about?

EDIT: Skipped that, trying the lame substitute “offer help to npc” now. I personally think Informs string handling is not so good.

Anyone any idea how to make the dummy help object I stuffed into the player invisible?