So for my TALP game, I need to keep it so that all commands can be (but are not limited to) VERB NOUN. For talking to NPCs, I have this code:
Understand "talk to [someone]" as talking to. Talking to is an action applying to one visible thing.
Understand "talk [someone]" as talking to.
This way, the player can type TALK TO NPC or TALK NPC, or just TALK (if there’s only one NPC). When I add the “talk [someone]” line, it overrides the “to” in implicit talking. So if I just say TALK in the presence of an NPC, the implicit action now says, “the NPC” instead of “to the NPC”.
Before I do a bunch of frustrating experimentation, since time is short, can someone tell me how to keep both lines but also keep the implicit “talk to”?
I think it should be something like:
rule for clarifying the parser's choice of someone when talking to:
say "(to [the noun]").
But the compiler doesn’t like the “[noun]” part of that, and my various attempts to try slightly different syntax without fully understanding what’s gone wrong have not surprisingly been unsuccessful. I’m out of time to think about this now but figured - perhaps wrongly - that a half-working solution is better than none.
If you only have a few characters I suppose you could just write specific rules for each:
rule for clarifying the parser's choice of Fred when talking to:
say "(to Fred").
rule for clarifying the parser's choice of Ginger when talking to:
say "(to Ginger").
That’s of course an inelegant hack though so hopefully you figure out the right way to do things and/or someone smarter than me comes along!
EDIT: oh, and by the way you can also do these two syntaxes in one line: understand “talk to/— [someone]” as talking to.
EDIT 2: I am an idiot who misplaced some parentheses, see below.
Thanks! I’ve had to do a lot of ugly stuff to make the game work for the verb-noun crowd and the complex parser crowd, so unless someone drops a piece of perfect code with a big bow on it in my lap, this will fit the general hackiness of the whole game!
** There was a fun autocorrect from “hackiness” to “tackiness,” which worked just as well.
You can try:
To decide which object is the prospective noun:
(- parser_results-->INP1_PRES -).
Rule for clarifying the parser's choice when talking to:
say "(to [the prospective noun])[command clarification break]".
@DeusIrae, I think that the error message that you got was from a misplaced closing bracket (outside the double quotes).
Oh for the love of God - that’s what I get for trying to write code on my phone and not triple-checking for stupid typos. Thanks!
Well, that works like a charm, although I have to say I don’t understand it at all and am not likely to anytime soon. Sometimes code is like a magic word to me; you just say it and POOF! Showtime.
No problem. Incidentally, the way that the parser choice message is constructed will automatically fill in missing prepositions found in the grammar line (as well as other fixed words), so if your only grammar line is:
Understand "talk to [someone]" as talking to.
Then the default behavior is
You talk to Bob.
You talk to Bob.
which may already suit your purposes.
Well, ack. Another textbook example of overcomplicating things, my forte. I never even tried to see if “talk NPC” would work without adding the second line, and it does.
I swear I will never learn to just keep it simple.