[i7] "After a person" not triggering with the player

[code]Living room is a room.
The box is an enterable open container. The box is in living room.

After a person (called P) entering box:
say “[P] has entered the box.”

Jane is a woman in living room. Player is Jane.

May is a woman in living room.
Every turn when turn count is 2:
try May entering box.[/code]

For some reason, this announces May entering the box just fine, but when the player does it, nothing happens. What am I doing wrong?

That’s the intended behavior for what you wrote. See section 12.14 of Writing with Inform:

If you want the rule to fire for the player and for NPCs, you should write “After an actor entering the box.” (And you’ll want to make that “have” adaptive so it doesn’t print “You has entered the box.”)

Oh, sweet, that’s simple enough. Thanks for the help!

While I’m at it, let me ask something else:

When the player opens the box, the game reports its contents (“You open the box, revealing an apple.”)

But when May opens it, it only reports her opening it (“May opens the box.”)

Is there some neat way to report a container’s contents when anyone opens it, not just you? When it’s visible, of course.

The rule that prints that message is actually pretty easy to adapt for your case:

Report an actor opening (this is the reveal any newly visible interior rule): if the actor is the player and the noun is an opaque container and the first thing held by the noun is not nothing and the noun does not enclose the actor: if the action is not silent: if the actor is the player: say "[We] [open] [the noun], revealing " (A); list the contents of the noun, as a sentence, tersely, not listing concealed items; say "."; stop the action.

Just replace the first “if the actor with the player” with “if the noun is visible” and put an “otherwise” clause in the innermost if to print a third-person message and you should be good to go.

[code]Report an actor opening (this is the new reveal any newly visible interior rule):
if the actor is the player and
the noun is an opaque container and
the first thing held by the noun is not nothing and
the noun does not enclose the actor:
if the action is not silent:
if the noun is visible:
say "[if the actor is player][We] [open][otherwise][actor] opens[end if] [the noun], revealing " (A);
list the contents of the noun, as a sentence, tersely, not listing
concealed items;
say “.”;
stop the action.

The new reveal any newly visible interior rule is listed instead of the reveal any newly visible interior rule in the report opening rules.[/code]

This doesn’t seem to work, it gives me problems along the lines of:

I suppose it could be worked around if I edited the actual default rulebook itself, but that’s a bit of an ugly solution if I want to share my source for example. Any solutions?

Are you using 6G60 rather than 6L02 by any chance?

Uff, I am. I hadn’t even realised a new version was out.

That being said, Erik Temple’s Glimmr Automap seems to break with the new version. I’m sort of relying on it, so I think I have to stick with 6G60.

Automap has been updated for 6L02, but Glimmr has not (and most likely will not be).

No problem doing this with 6G60, anyway. Just find the “reveal any newly visible exterior” rule in the 6G60 Standard Rules (just go to Open Extension and the Standard Rules should be listed under Graham Nelson), copy that rule out, modify it as you want, and substitute it in. The way you do that is you label your new rule “(this the the reveal any newly visible exterior for anyone rule)” or something like that and then write “The reveal any newly visible exterior for anyone rule is listed instead of the reveal any newly visible exterior rule in the report opening rulebook.” (I think; haven’t checked the syntax.)

Yeah, this is the one in the 6G60 rules:

Report an actor opening (this is the reveal any newly visible interior rule): if the actor is the player and the noun is an opaque container and the first thing held by the noun is not nothing and the noun does not enclose the actor, stop the action with library message opening action number 4 for the noun.

That last line is giving me a bit fo trouble, though. I suppose I should go about editing the “library message opening action number 4”?

Well, you could use one of Ron Newcomb’s extensions (Default Messages or Custom Library Messages), but if you’re rewriting the rule for your own project it’s just as simple to write your own message – you can see what it looks like in the 6L02 rule, but you have to put in “You” for “[We]” (or in the case where the actor isn’t the player, you write “[The person asked]”).

Alright, that solution was easier than I figured it’d be. Works just perfectly now, thanks!

Alright, I’ll keep them coming.

How do I make it so that a room is dark to only a specific person? Let’s say they’re wearing a blindfold for instance. I don’t quite grasp how to mess with the visibility rules.

Do you want it to apply only when that person is the player, or when the player gives them an order as well?

I think it’s probably okay if it’s just the player. I’ve got some AI behaviour depending on them seeing things, but it’s very simple to work around that without messing with their visibility rules.

Oh well that’s hard. I don’t think the visibility rules actually get checked for NPC actions, so you have to do something else that just interrupts the action when the NPC is blindfolded, and you can write a visibility rule (see 12.19) for the player. There will be a lot of stuff to deal with, though. Here is an example:

[code]Lab is a room. Jane is a woman in Lab. Alice is a woman in Lab. The player is Alice. Alice wears a blindfold.
Persuasion rule: persuasion succeeds.

Definition: a person is blindfolded if it wears the blindfold.

Visibility rule when the player is blindfolded:
there is insufficient light.

After deciding the scope of the player: place Jane in scope.

Report Jane examining the player: say “Oh my.”

Before a blindfolded person doing something when action requires light (this is the blindfolded people can’t see rule): say “[The person asked] is blindfolded and can’t see!” instead.

Test me with “look/x jane/jump/jane, x me/remove blindfold/look/jane, x me/jane, jump/drop blindfold/jane, wear blindfold/jane, x me/jane, jump”.

Unsuccessful attempt by Jane doing something: say “[The person asked] was unable to do that because of [the reason the action failed].”[/code]

Output:

Note that, as discussed in 12.19, changing the visibility doesn’t actually affect looking–you’d need a special case for that. Also, the report rules for Jane’s actions will run even if you’re wearing the blindfold. But the rules for Jane wearing the blindfold prevent her from doing the stuff that requires light and not the stuff that doesn’t–the key here is the phrase “action requires light.” (I’m not sure why “Procedural rulebook” is listed as the reason the action failed.)

BTW you can probably post these as separate threads and you’ll get more response – you can tag them “6G60” in the subject heading.

Oh, thanks. That looks like a pretty neat workaround for the NPCs. I’ll use just that.

And yeah, maybe I’ll make seperate threads. I’m kinda afraid of flooding the board with questions, though.