New Persuasion Rule Bug?

Hello,

I’m not sure if this should be reported as a bug. The following code triggers the answering it that action instead of a persuasion rule when the action involves a noun:

Code:

"Sticky Situation" by neil

The Lair is a room. “The cavern is stuffed with webs criss-crossing and spreading like a maze throughout.”

Buzz is a male animal. The description of Buzz is “Buzz, your overly-enthusiastic physicist friend, has pulled a Goldblum. ‘Help me,’ Buzz implores from the center of a web.”
A web is in the Lair. The web incorporates Buzz.

Test me with “Buzz, get off web / Buzz, wait”

end.

The code above will act correctly if Buzz is on the web instead of part of it , so there is a work-around.

Neil

It’s worse than that! Consider this.

[code]“Test”

The Testing Room is A Room. The item is in the testing room. The player is part of the item.

Test actions with “actions on / test me / actions off”.

Test me with “take item / showme yourself / get off item / showme yourself / exit / showme yourself / take item / showme yourself / exit / exit / exit / exit / exit / exit / exit / exit / showme item”.[/code]

Here, taking and getting off (other actions probably do this too) the item that the player is part of gives a programming error and the player is still part of the item. However, exiting seems to work OK with the the player now no longer part of the item. For some reason, trying to take the item at this point gives a message saying that you need to get out of the item first and exiting works as if you were still part of the item. Finally, “showme item” gives an infinite loop.

I don’t know if it’s a bug, but I can’t tell what’s going on either.
If Buzz is not part of anything, asking him to get off anything is parsed as asking him to get off it; but if he is part of something (like the web), then asking him to get off anything is parsed as answering him that.
Why is this?

Also, adding “Modified Exit by Emily Short” causes the whole game to stop responding.

[code]“Test”

Include Modified Exit by Emily Short.

The Testing Room is A Room. The item is in the testing room. The player is part of the item.

Test actions with “actions on / test me / actions off”.

Test me with “exit / take item”.[/code]

It seems that incorporation is treated unusually here.

I bet what’s happening is that the web is out of Buzz’s scope. The scope routines have a notion of bubbling up to a container containing the actor, but not of bubbling up to a thing incorporating the actor. So “get off web” fails to parse, and it falls back to the general answering action.

Does this work as a general fix? I’m not sure whether I really want “the person asked” here, or whether the scope rule is too computationally expensive (though I’d hope not, since it only runs when the person asked is part of something).

After deciding the scope of a person when the person asked is part of something: repeat with item running through things that incorporate the person asked: place item in scope.

EDIT: Well, it didn’t work with climbingstars’ test case, but before that crashed Inform (grumble) I noticed that it was giving a lot of reports of darkness, as if it were invoking the eternal darkness bug or the spurious darkness bug. Which makes me think that making the player part of something is probably irredeemably bugged and you Shouldn’t Do It.

You could write it like this.

After deciding the scope of a person when the person asked is part of something (called the whole): place the whole in scope.

You don’t really need the “repeat” since a thing can only ever be part of one thing at a time.

It is actually the spurious darkness bug here. You can sort that out by adding this line.

The check light in new location rule is listed in the carry out exiting rulebook.

However, this is unrelated to the parts bug. It just so happen that they both affect the exiting action.

Try this Neil

“Sticky Situation” by neil

The Lair is a room.
“The cavern is stuffed with webs criss-crossing and spreading like a maze throughout.”

Buzz is a male animal.
The description of Buzz is
“Buzz, your overly-enthusiastic physicist friend, has pulled a Goldblum. ‘Help me,’ Buzz implores from the center of a web.”

A web is in the Lair. Buzz is on the web.

persuasion rule for asking Buzz to try waiting:
rule succeeds.

before asking Buzz to try getting off the web:
if Buzz is on the Web or Buzz is part of the web:
say “Buzz gets off the web.”;
now Buzz is in Lair instead;
otherwise:
say “Buzz isn’t on the web.” instead.

Test me with “Buzz, get off web / Buzz, wait”

I’ve reported this. You can find it here.

Hello,

Thanks climbingstars. Scope inclusion doesn’t solve the problem:

“Sticky Situation” by neil

The Lair is a room. “The cavern is stuffed with webs criss-crossing and spreading like a maze throughout.”

Buzz is a male animal. The description of Buzz is “Buzz, your overly-enthusiastic physicist friend, has pulled a Goldblum. ‘Help me,’ Buzz implores.”
A web is in the Lair. The web incorporates Buzz.
The bug spray is in the lair.

After deciding the scope of an animal when the person asked is part of something (called the whole): place the whole in scope.

Test me with “Buzz, get bug spray”.

Asking to get the spray is converted to answering it that (and using “animal” instead of “person” after “when …” doesn’t compile).

Neil

The problem here is not about scope and it is not about persuasion either since you get exactly the same thing when the player is part of something. The real error here is how parts work, since we are getting programming errors (which occur during the parsing of the player’s command), infinite loops and compiler crashes because of it.

Without knowing anything about the internals, I think there are two problems here; one involving scope when an NPC is part of something and one involving weird behavior when the player is part of something.

For Neil’s test case, the “answering it that” issue arises when the object you’re talking about is out of Buzz’s scope. The original solution only puts the web in scope, so you get “answering it that” behavior when you tell Buzz to do anything with anything else. But you can solve this by putting more things in scope:

[code]“Sticky Situation” by neil

The Lair is a room. “The cavern is stuffed with webs criss-crossing and spreading like a maze throughout.”

Buzz is a male animal. The description of Buzz is “Buzz, your overly-enthusiastic physicist friend, has pulled a Goldblum. ‘Help me,’ Buzz implores.”
A web is in the Lair. The web incorporates Buzz.
The bug spray is in the lair.
After deciding the scope of a person when the person asked is part of something:
repeat with avatar running through visible things:
place avatar in scope.

Test me with “buzz, get web/buzz, get bug spray”.

A persuasion rule: persuasion succeeds.[/code]

Of course you have to figure out whether you want everything that the player can see to be in scope for Buzz. [EDIT: “the animal asked” doesn’t compile because “the person asked” is a set phrase; see sections 12.3 and 12.12 of the documentation.]

Having the player be part of something seems to raise a host of other issues, but a workaround for now is not to make the player part of something.

I’m sure the second one is when the actor is part of something, so it will include the first case. (If the NPC responds to orders.)

Well, as I said I don’t know what’s going on in the internals here, but in the code I posted Buzz can get the bug spray and exit the web properly – although having him exit something he’s part of causes trouble. Try this test code:

Everything proceeds as normal until the “showme web” command after Buzz has exited the web, which yields an infinite loop similar to the one in climbingstars’ test case:

So exiting from something that the actor is part of is bugged (I think the proper behavior is probably to make it fail), but the programming errors may depend on whether it’s the player or someone else who’s part of the item.

Oh, FWIW, thanks to my terrible typing I just discovered that the programming error in climbingstars’ scenario happens when there’s a parser error. Try “get foo” and you get the same programming error. (And since the item isn’t in scope for the player, because the player is in darkness, I think “get item” is being treated the same as “get foo.”)

It seems that the programming errors originate from this bit of code from “SearchScope” in “Parser.i6t”.

if (thedark == domain1 or domain2) {
	DoScopeActionAndRecurse(actor, actor, context);
	if (parent(actor) has supporter or container)
		DoScopeActionAndRecurse(parent(actor), parent(actor), context);
}

This line in particular.

parent(actor) has supporter or container

Here, “parent(actor)” evaluates to nothing and then testing whether nothing is a container or a supporter gives the programming error.

So it does seem that the problems with scope are a byproduct of the bad handling of the player being a part of something.

It also appears that the unresponsiveness caused when using “Modified Exit by Emily Short” is due to the constructing the status line code. This removes the unresponsiveness.

[code]“Test”

Include Modified Exit by Emily Short.

Rule for constructing the status line: stop.

The Testing Room is A Room. The item is in the testing room. The player is part of the item.

Test actions with “actions on / test me / actions off”.

Test me with “exit / take item”.[/code]

However, this does sacrifice the utility of the status line.