MantisBT - Core Inform
View Issue Details
0000956Core InformSource text and punctuationpublic2012-07-28 16:142014-05-07 07:33
dg 
graham 
normalseriousalways
closedfixed 
x86LinuxAny
6G60 
6L02 
(serious/mild) Game compiles but misbehaves
0000956: Names with 'player' in confuse the parser
If you have a name which starts with the word 'Player', as in 'Player Alice' in the example below, then rules which refer to the player seem to go horribly wrong.

In the test case below, the 'instead of examining the player' rule should fire. I suspect that when the rule was parsed, 'player' was treated as shorthand for 'Player Alice' rather than the current player.

This causes silent, subtle breakage of games --- I only noticed in my (real) game when I started testing with a different player avatar and noticed that some rules stopped working.
There is a room.
Player Alice is a person.
Instead of examining the player:
say "Examining rule fires."
Test me with "x me".
No tags attached.
has duplicate 0000900closed graham Inform gets the player global mixed up with player object. 
Issue History
2012-07-28 16:14dgNew Issue
2012-07-31 12:22zarfNote Added: 0001731
2012-08-01 18:12EmacsUserRelationship addedchild of 0000905
2012-08-01 18:13EmacsUserNote Added: 0001737
2012-08-01 18:13EmacsUserStatusnew => confirmed
2012-08-01 18:13EmacsUserCategoryRules and rulebooks => Source text and punctuation
2012-08-01 18:13EmacsUserDescription Updatedbug_revision_view_page.php?rev_id=751#r751
2012-08-01 18:14EmacsUserSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=753#r753
2012-08-31 10:31zarfNote Added: 0001832
2012-08-31 10:37zarfNote Added: 0001833
2012-10-04 10:26mattweinerNote Added: 0001860
2013-10-19 13:14zarfRelationship addedhas duplicate 0000900
2014-01-26 08:54grahamRelationship deletedchild of 0000905
2014-03-10 14:56grahamNote Added: 0002547
2014-03-10 14:56grahamStatusconfirmed => resolved
2014-03-10 14:56grahamResolutionopen => fixed
2014-03-10 14:56grahamAssigned To => graham
2014-05-07 07:32jmcgrewFixed in Version => 6L02
2014-05-07 07:33jmcgrewStatusresolved => closed

Notes
(0001731)
zarf   
2012-07-31 12:22   
Fits in umbrella issue 905.
(0001737)
EmacsUser   
2012-08-01 18:13   
Confirmed, and slightly reduced.
(0001832)
zarf   
2012-08-31 10:31   
You can get the same result with any one-word variable that's part of an object name:


The Kitchen is a room.
The player carries a rock.
Mister X is a person.

Every turn:
let X be the rock;
say "X is [X].";
try examining X;

Note that the say line grabs the local variable X, but the try line grabs the object literal Mister X.
(0001833)
zarf   
2012-08-31 10:37   
Interestingly, there's a declaration-order dependency here. If we change X to a global variable, we get the same result:

X is a thing that varies.
Mister X is a person.

[same output as before]

But if we reverse the order of those declarations, the compiler catches it:

Mister X is a person.
X is a thing that varies.

Problem. You wrote 'X is a thing that varies' : but this seems to say that a thing is a value, like saying 'the chair is 10'.
(0001860)
mattweiner   
2012-10-04 10:26   
Probably not worth filing as a separate bug, but if you the object with "player" in its name isn't a person, then some bits of code with "who is not the player" in them won't compile:

Hop is a room. Danny is a man in Hop. Barbara Ann is a woman in Hop. The record player is a thing in Hop.
Every turn: say "[Random visible person who is not the player] comes over and asks you to dance."

However, this compiles and behaves as expected:

Hop is a room. Danny is a man in Hop. Barbara Ann is a woman in Hop. The record player is a thing in Hop.
Instead of examining a person who is not the player: say "Examining rule fires."

(Forum thread: http://www.intfiction.org/forum/viewtopic.php?f=7&t=5948 [^] Note that this is especially likely to cause problems with Eric Eve's Conversation Framework.)
(0002547)
graham   
2014-03-10 14:56   
Fixed. Inform already had a mechanism to give priority to local variables in resolving ambiguities like this, and now gives priority to global ones too.