Using Inform 6.31, I came across what looks like a bug in Standard Library 6/11. However, the root cause seems to still persist in Standard Library 6.12.4. [edit: No, it fortunately doesn’t persist to 6.12.4.]
First, the demonstration code:
Constant Story "Something Broke";
Constant Headline "^(unexpected RTE)^";
Include "Parser";
Include "VerbLib";
Include "Grammar";
Object Start "Starting Point"
with description
"An uninteresting room."
has light;
Object machine "machine" Start
with name 'machine',
description
"It has a prominent switch.",
add_to_scope sw1
has static;
Object sw1 "switch"
with name 'switch',
desription
"It doesn't seem to be attached well.";
[ Initialise ;
location = Start;
];
This yields interaction:
Starting Point
An uninteresting room.
You can see a machine here.
>TAKE SWITCH
[** Programming error: tried to test "has" or "hasnt" of nothing **]
[** Programming error: tried to test "has" or "hasnt" of nothing **]
Taken.
The problem seems to originate in routine AttemptToTakeObject (in verblibm.h), which has a block:
! Consult the immediate possessor of the item, if it's in a container
! which the player is not in.
i = parent(item);
if (i ~= ancestor && (i has container || i has supporter)) { ! PROBLEM HERE IF i == nothing
after_recipient = i;
k = action; action = ##LetGo;
if (RunRoutines(i, before) ~= 0) { action = k; rtrue; }
action=k;
}
Using a Replace directive and substituting the if statement’s condition with:
if (i ~= nothing or ancestor && (i has container || i has supporter)) { ! RTEs no longer occur
seems to stop the RTEs.
Is this a real bug in the Standard Library, or am I missing something?