Today's not quite so newbie question - word detection in conversation

Back when I used to code adventure games in the late 80’s, the utility I used made it very easy to recognise flexible sentences by picking up certain key words. For example, typing “Ask Barry if the map is in the Sinister Inn”, “Ask Barry about map” and “Ask Barry where the map is” could all be made to produce the same response by simply applying the logic of if the player asks Barry and the sentence mentions the map anywhere in the sentence, make Barry give the response “Arrr, nobody knows where the map is now.” One line of code would do the job, by reading the input as ASK BARRY blah blah blah MAP blah blah and ignoring the blahs.

However, in the far more sophisticated world of Inform 7, I am having trouble replicating this kind of flexibility. I can’t find a way of getting it to just pick up on key words in a sentence and, crucially, getting it to ignore irrelevant words. Is this possible? At the moment I can’t make it treat “Ask Barry about map” and “Ask Barry about finding the map” as needing the same response, without specifically writing code for both exact sentences.

1 Like

The Recipe Book I think gets you where you want to go:

7.8 Saying Complicated Things

Specifically the Complimentary Peanuts example.

2 Likes

Brilliant, that’s the thing I’m looking for :slight_smile: