Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000956Core InformSource text and punctuationpublic2012-07-28 16:142014-05-07 07:33
Assigned Tograham 
Platformx86OSLinuxOS VersionAny
Product Version6G60 
Target VersionFixed in Version6L02 
Summary0000956: Names with 'player' in confuse the parser
DescriptionIf 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.
Minimal Source Text To Reproduce
There is a room.
Player Alice is a person.
Instead of examining the player:
	say "Examining rule fires."
Test me with "x me".
TagsNo tags attached.
Effect(serious/mild) Game compiles but misbehaves
Attached Files

- Relationships
has duplicate 0000900closedgraham Inform gets the player global mixed up with player object. 

-  Notes
zarf (developer)
2012-07-31 12:22

Fits in umbrella issue 905.
EmacsUser (manager)
2012-08-01 18:13

Confirmed, and slightly reduced.
zarf (developer)
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.
zarf (developer)
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'.
mattweiner (reporter)
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: [^] Note that this is especially likely to cause problems with Eric Eve's Conversation Framework.)
graham (administrator)
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.

- Issue History
Date Modified Username Field Change
2012-07-28 16:14 dg New Issue
2012-07-31 12:22 zarf Note Added: 0001731
2012-08-01 18:12 EmacsUser Relationship added child of 0000905
2012-08-01 18:13 EmacsUser Note Added: 0001737
2012-08-01 18:13 EmacsUser Status new => confirmed
2012-08-01 18:13 EmacsUser Category Rules and rulebooks => Source text and punctuation
2012-08-01 18:13 EmacsUser Description Updated View Revisions
2012-08-01 18:14 EmacsUser Steps to Reproduce Updated View Revisions
2012-08-31 10:31 zarf Note Added: 0001832
2012-08-31 10:37 zarf Note Added: 0001833
2012-10-04 10:26 mattweiner Note Added: 0001860
2013-10-19 13:14 zarf Relationship added has duplicate 0000900
2014-01-26 08:54 graham Relationship deleted child of 0000905
2014-03-10 14:56 graham Note Added: 0002547
2014-03-10 14:56 graham Status confirmed => resolved
2014-03-10 14:56 graham Resolution open => fixed
2014-03-10 14:56 graham Assigned To => graham
2014-05-07 07:32 jmcgrew Fixed in Version => 6L02
2014-05-07 07:33 jmcgrew Status resolved => closed

Copyright © 2000 - 2010 MantisBT Group
Powered by Mantis Bugtracker