[SOLVED] I7: Asking people in other rooms to try doing...

The situation: the player is in one room, another person (let’s call them Ogg) is in another room, and yet the player wants to ask Ogg to try doing something.

Just placing Ogg in scope works, but it works for all commands. I can now examine Ogg from eight rooms away, which is not ideal.

I initially tried this (which doesn’t work):

After deciding the scope of the player while asking someone to try doing something:
	place Ogg in scope.

However, the “while” does not seem to be evaluating as I would have expected, and this code produces, “You seem to want to talk to someone, but I can’t see whom.”

Here’s my current workaround:

After deciding the scope of the player:
	repeat with target person running through people:
		place target person in scope.

Before doing something to someone (called the target person):
	if ((the target person is not in the location) and (the target person is not in an open container) and (the target person is not in a transparent container)):
		say "[target person] isn't here." instead.

Persuasion rule for asking someone (called the target person) to try doing something:
	persuasion succeeds.

It seems like there must be a cleaner way to do this. Any suggestions?

Scope and talking to characters aren’t my strong areas, but this looks pretty good to me.

For Ogg to be able to be recognised by the parser as the possible recipient of an order, he must be in scope on every turn, so your first clause is necessary.

For him to respond to persuasion, the third clause is necessary.

Then the 2nd clause restores the block on attempts to do things to characters who aren’t present, replacing the element of the scope rules you undid by putting everyone in scope all the time.

Probably the thing to check is that there isn’t some other broad class of action also not covered by ‘doing something to someone’ by which the player could sneak an action to a non-present character. I find stuff like this creeps up on me when I fiddle with fundamentalish rules like scope and access and such.

  • Wade

This may not be any simpler, but instead of hand-rolling your own visibility check you could give everyone a body and check whether the body is visible.

[code]Lab is a room. Lab Annex is a room. Ogg is a person in Lab Annex.

After deciding the scope of the player: place Ogg in scope, but not its contents.

Ogg’s body is part of Ogg. Ogg’s body is privately-named.

Before doing something when the current action involves Ogg and the person asked is the player and Ogg’s body is not visible: say “Ogg’s not here.” instead.

Persuasion rule: persuasion succeeds.[/code]

Since the body is privately-named, I don’t think the player will ever be able to refer to it, and I don’t think it’ll show up in anything like room descriptions or “x ogg” (though if you have rules for parts of people you’ll have to exclude the body). This should also scale up reasonably well to all people, by making a body part of every person. And I think if you have other rules that put people in scope (in case you sometimes can examine someone through a window for some reason) then this shouldn’t interfere, since those other rules will place ogg and its contents in scope and so the body will be visible.

BTW, in your original code it seems to me you could say “Place every person in scope” instead of looping over people. But in this one “Place every person in scope, but not its contents” fails with a confusingish error message ("‘person’ seems to be a person, whereas I was expecting to find an object there"). Not sure if it’s a bug.

I like your solution! Keeps me from having to roll my own container rules. I’ll try implementing this version and see how it goes. (And thank you for reminding me of the existence of “but not its contents”, which had slipped my mind.)

That’s exactly the problem I got, which is why I chose to loop. It looks like no one has reported this in the Mantis tracker yet, so I’ll send in a bug report and see what people think.

That’s an error message bug. The phrase is defined as “place (O - an object) in scope”, so it cannot accept a description (“every person” or “all people”).

Whoops. Sorry about that - I misunderstood what bug 917 was saying and didn’t recognize it as a duplicate.

Ah, I got mixed up with the syntax of the “place (O - an object) in scope” phrase (in fact I was originally trying to do it with “now every person is in scope,” which I guess doesn’t make sense because “X is in scope” isn’t a condition).