curiousdannii-testing / inform7-imported-bugs

0 stars 0 forks source link

[I7-1995] [Mantis 2031] "Report going" message incorrect when NPC enters room while player is on enterable supporter #89

Open curiousdannii-testing opened 2 years ago

curiousdannii-testing commented 2 years ago

Reported by : otistdog

Description :

The normal message for an NPC entering a room enclosing the player looks like:

Bob arrives from the east.

However, if the player is on an enterable supporter when the NPC enters, the message is:

Bob goes west.

This is the message that would normally be seen if the player were in the "room gone from" for Bob's going action.

The root cause may be buried a little more deeply. If this is something that should be reported against the Inform 6 library, feel free to close this, and I will resubmit.

Steps to reproduce :

"Bug Report"

Place is a room.

Bob is a man in Place.

An enterable supporter called an armchair is in Place. The player is on the armchair.

An enterable container called a bathtub is in Place. [Issue doesn't occur for enterable containers.]

Someplace Else is east of Place.

Every turn:
    if turn count is odd:
        try Bob going east;
    otherwise:
        try Bob going west.

test me with "z / z / z / get up / z / z / z / sit on armchair / z / z / z".

Additional information :

Issue also occurred in 6L38.

imported from: [Mantis 2031] "Report going" message incorrect when NPC enters room while player is on enterable supporter
  • status: Reported
  • resolution: Open
  • resolved: 2022-04-07T05:02:26+10:00
  • imported: 2022/01/10
curiousdannii-testing commented 2 years ago

557058:4c095ffd-6d6f-47ce-9e73-77c613347b86:

Comment by otistdog :
I poked around at this a bit more; it looks like it may be an issue with the way that some of the conditions in the Standard Rules' "describe room gone into" rule are being interpreted. If the following is added to the example code above:

=======================

Before an actor going:
say "[location], actor = [actor], room gone from = [room gone from], room gone to = [room gone to], vehicle gone by = [vehicle gone by], thing gone with = [thing gone with]>[line break]";

Report an actor going (this is the alt describe room gone into rule):
if the player is the actor:
if the action is not silent:
produce a room description with going spacing conventions;
otherwise:
say "";
if the noun is a direction:
say "";
if the location is the room gone from or the player is within the
vehicle gone by or the player is within the thing gone with:
say "[if the location is the room gone from]YES[otherwise]no[end if], player is within vehicle gone by? [if the player is within the vehicle gone by]YES[otherwise]no[end if], player is within thing gone with? [if the player is within the thing gone with]YES[otherwise]no[end if]>";
if the room gone from is the room gone to:
continue the action;
otherwise:
say "";
if the noun is up:
say "[The actor] [go] up" (A);
otherwise if the noun is down:
say "[The actor] [go] down" (B);
otherwise:
say "[The actor] [go] [noun]" (C);
otherwise:
let the back way be the opposite of the noun;
if the location is the room gone to:
let the room back the other way be the room back way from the
location;
let the room normally this way be the room noun from the
room gone from;
if the room back the other way is the room gone from or
the room back the other way is the room normally this way:
if the back way is up:
say "[The actor] [arrive] from above" (D);
otherwise if the back way is down:
say "[The actor] [arrive] from below" (E);
otherwise:
say "[The actor] [arrive] from [the back way]" (F);
otherwise:
say "[The actor] [arrive]" (G);
otherwise:
if the back way is up:
say "[The actor] [arrive] at [the room gone to] from above" (H);
otherwise if the back way is down:
say "[The actor] [arrive] at [the room gone to] from below" (I);
otherwise:
say "[The actor] [arrive] at [the room gone to] from [the back way]" (J);
otherwise if the location is the room gone from:
say "[The actor] [go] through [the noun]" (K);
otherwise:
say "[The actor] [arrive] from [the noun]" (L);
if the vehicle gone by is not nothing:
say " ";
if the vehicle gone by is a supporter:
say "on [the vehicle gone by]" (M);
otherwise:
say "in [the vehicle gone by]" (N);
if the thing gone with is not nothing:
if the player is within the thing gone with:
say ", pushing [the thing gone with] in front, and [us] along too" (O);
otherwise if the player is within the vehicle gone by:
say ", pushing [the thing gone with] in front" (P);
otherwise if the location is the room gone from:
say ", pushing [the thing gone with] away" (Q);
otherwise:
say ", pushing [the thing gone with] in" (R);
if the player is within the vehicle gone by and the player is not
within the thing gone with:
say ", taking [us] along" (S);
say ".";
try looking;
continue the action;
say ".";

The alt describe room gone into rule is listed instead of the describe room gone into rule in the report going rules.

=======================

then you can see that two of the conditions in the "key block" are being interpreted as true that don't seem like they should be interpreted as true:

=======================

>[8] sit on armchair
You get onto the armchair.

Bob goes west.

=======================

Note that "location" is the location of the actor in the above, so it is correctly evaluating as false.

curiousdannii-testing commented 2 years ago

557058:4c095ffd-6d6f-47ce-9e73-77c613347b86:

Comment by otistdog :
Good point! I didn't think of the implications of being "within nothing" when nothing is a defined object.

Since the line of code in question is part of the Standard Rules, the fix has to happen there. I would just add that it might be better to have conditions like "the player is enclosed by the vehicle gone by" and "the player is enclosed by the thing gone with" to handle cases where a complex object is the thing conveying the player, e.g. a thing with an enterable container that is part of it.

curiousdannii-testing commented 2 years ago

557058:4c095ffd-6d6f-47ce-9e73-77c613347b86:

Comment by climbingstars :
It looks like the issue is with this line of code.

"if the location is the room gone from or the player is within the vehicle gone by or the player is within the thing gone with:"

Where both "if the player is within the vehicle gone by" and "if the player is within the thing gone with" are evaluating as true because "within" is connected to the containment relation therefore the player is within nothing when they are on a supporter.

This can be fixed by changing it to this.

"if the location is the room gone from or the holder of the player is the vehicle gone by or the holder of the player is the thing gone with:"