[SOLVED] Odd Problem Involving "Answering it that"

Well, here’s the code

Instead of answering Clementine that "hello/hi/howdy/mornin/good morning":
[	If the topic understood is "hello/hi/howdy/mornin/good morning":]
	Say "[first time]'Good morning papa.' she says, with bright eyes. [only]She flashes you a big smile.";
	Rule succeeds;

The only option that works is “good morning.” For some reason, the “block answering rule” supercedes when I try any of the others. I learned this using the ‘rules’ debugging command. I’ve even tried changing the order of the options as well as singling out “hello” and dropping “good morning.” Still the block answering rule supercedes.
Um … Huh? I don’t understand why or how. :confused:
EDIT: I just tried removing the ‘good morning’ option and that made all the others work fine.

This is what I get with both ‘Rules’ and ‘Actions’ debugging turned on:

>clem, hello
[Rule "declare everything initially unmentioned rule" applies.]
[answering Clementine that "hello"]
[Rule "announce items from multiple object lists rule" applies.]
[Rule "set pronouns from items from multiple object lists rule" applies.]
[Rule "before stage rule" applies.]
[Rule "Before doing anything to Clementine" applies.]
[Rule "instead stage rule" applies.]
[Rule "investigate player's awareness before action rule" applies.]
[Rule "player aware of his own actions rule" applies.]
[Rule "check stage rule" applies.]
[Rule "carry out stage rule" applies.]
[Rule "after stage rule" applies.]
[Rule "investigate player's awareness after action rule" applies.]
[Rule "report stage rule" applies.]
[Rule "block answering rule" applies.]
There is no reply.
[Rule "last specific action-processing rule" applies.]
[answering Clementine that "hello" - succeeded]

I’d guess that “hello morning” and “mornin morning” would have worked, too. Where Inform takes slashes to indicate alternatives, they only separate single words. “morning” as a standalone word at the end means all of the others have to end “morning” too.

1 Like

I think this is your culprit:

"hello/hi/howdy/mornin/good morning"

This will accept “hello morning”, “hi morning”, “howdy morning”, and “mornin morning” as well as “good morning”, but not any of those words on their own, because you’ve made the word “morning” mandatory (the slashes switch between single words – you can’t use them with spaces in that way). Try making “morning” optional:

"hello/hi/howdy/mornin/good morning/--"
3 Likes

AHA! Yep. That was the problem. I didn’t know about that “cool trick” of adding the /-- to the end. I’m sure that’ll come in handy in the future as well.

1 Like

Hmm … Soo … When I try to put that in the “topic understood” line, none of them work. I must be using it wrong

Instead of answering Clementine that "[something]":
	If the topic understood is "hello/hi/howdy/mornin/good morning/--":

Can “topic understood” not contain multiple entries like that?

Yeah, I think that’s the issue - try “if the topic understood matches”, not “is” (sorry, on my phone so can’t test to confirm!)

Nope, no good.

The problem here is that you use “[something]” in the rule preamble. That’s not necessary if you deal with the topic understood in the rule body.

So you could just write:

Instead of answering Clementine that:
	if the topic understood matches ...

and so on.
(Use “matches” to require an exact match, or “includes” to require that “the given snippet includes words matching the specification, either at the beginning, in the middle, or at the end”. See 18.33.)

But note that if you’re defining it like this “hello/hi/good morning/--”, since you’re making “morning” optional, the game will also understand combinations like “hi morning”, and just “good” on its own, as the greeting.

It’s not necessarily bad to understand more than the actual intended meanings, but it’s something to keep in mind. Especially if you later add more rules and topics, then they might overlap and clash with each other.

So, I’d recommend to split it up like this:

Understand "hello/hi/howdy" or "good morning" as "[morning]".

And then using that either so:

Instead of answering Clementine that:
	if the topic understood matches "[morning]":
		say "'Hello there,' she says.";
	otherwise:
		say "What do you mean by [the topic understood]?".

Or so:

Instead of answering Clementine that "[morning]":
	say "'Hello there,' she says."

See also 17.13. New tokens in the docs.

4 Likes

MARVELOUS!! Thank you!
I didn’t realize you could do that sort of thing, re: using understand that way. Cool.
Much better now. :smiley: