I was giving some final touches to my first game(then it’s on to perfecting my second), and I was going over one of my conversation tables with my NPCs when I realized that the program will not match subjects if the player types ‘the’ before them, unless that is taken account of in the table. I thought it would, because I thought that under the ‘topic’ column, it would be the same as an ‘Understand’ phrase, where the player would not have to type ‘the’, but could if he wanted to. Is there any way to get around this? or will I have to go through all of my tables and take account of ‘the’??
I’ve never done it, which is why I did a documentation search for you.
Give it a try and report back! I’m curious as well.
The rule as you’ve written is going to apply to everything the player types, so make sure that it’s not necessary in the game to refer to “the grand canyon”. You may want to limit it with something like…
After reading a command when asking it for: (not sure if that works, but something like that.)
You can’t specify an action in “after reading a command” rules, because the parser hasn’t had a chance to look at the input yet. You could in theory use a “before asking someone about” rule that modifies “the topic understood” but that gets a bit messy because you’ll have to drop down to the I6 level. (I7 doesn’t let you do much with snippets directly.)
It also depends on how you’ve defined your table of conversation topics (since that is what you seem to be doing). If you have a bunch of “apple”, “orange”, “Bob” as the topic column, then you’re right, it will only match the exact string. But if you put “[apple]”, “[orange]”, “[Bob]” instead, then it will use the full power of parser and Understand directives to figure out which one you want to pick. I think. It’s worth trying. I tried to find a documentation reference to back me up but I was unsuccessful. So the only solution is to try it and see what happens!
It sounds like you are testing against various topics by checking “if the topic understood matches topic entry,” which checks if the player’s input matches the conversation topic exactly. A much more flexible way to do this is to test “if the topic understood includes topic entry.” This checks to see if the topic in your conversation table occurs anywhere in the player’s input, and ignores any extraneous words (including “the”). For example:
[code]Test Chamber is a room.
A man called Bob is in the Test Chamber.
Table of Bobversation
“apple/apples” “‘Yeah, I like apples,’ says Bob.”
“orange/oranges” “‘Don’t like oranges so much,’ says Bob.”
“weather” “‘Heard it might rain later,’ says Bob.”
After asking Bob about something:
repeat through Table of Bobversation:
if the topic understood includes topic entry:
say “[answer entry][paragraph break]”;
say “Bob looks at you blankly.”
Test me with “ask bob about the apple / ask bob about the crate of oranges / ask bob about the awful weather we’ve been having / ask bob about the square root of two”.[/code]
See also Example 376: Complimentary Peanuts in the Inform documentation.