There are numerous grammar definitions that use the held token. To my dismay, I have just discovered that if you are using no_implicit_actions and you try to perform any of the actions that use these grammar definitions when you are not holding the relevant object, then you get:
[** Programming error: tried to find the "parent" of nothing **]
[** Programming error: tried to test "has" or "hasnt" of nothing **]
You aren't holding that.
I have tried to find the source of the error in the Inform 6 library (Iām using the latest build downloaded today, 6 September 2020), but the library code is like a dogās breakfast and I canāt make sense of it. Iām sure this didnāt happen before I upgraded the library, but havenāt confirmed this yet.
I canāt find anything helpful with debug commands. All I know is that it appears to be in parser.h. The message at the end is from the NOT_HELD error token.
If I donāt use no_implicit_actions, it tries an implict take and everything works fine, but I donāt want implicit takes.
Include "parser"; Include "verblib";
Object room "Room"
with description "You are in a room.",
has light;
Object hat "hat" room
with
name 'hat',
description "a hat",
has clothing;
[ Initialise;
no_implicit_actions=true;
location = room;
];
Include "grammar";
>wear hat
[** Programming error: tried to find the āparentā of nothing **]
[** Programming error: tried to test āhasā or āhasntā of nothing **]
You arenāt holding that.
You guys are life savers. Thank you so much! Iāve downloaded the new parser.h with the fix, done a quick recompile and everything seems to be working as it should. Iāll give it a more thorough test tonight.
Sorry Garry, but the bug is still there with Drop (it comes from the same lines of code as above.):
Include "parser"; Include "verblib";
Object room "Room"
with description "You are in a room.",
has light;
Object bag "bag" room
with name 'bag',
description "It's a bag",
has container open;
Object key "key" bag
with name 'key',
description "It's a key",
has;
[ Initialise;
no_implicit_actions=true;
move bag to player;
location = room;
];
Include "grammar";
drop key
[** Programming error: tried to find the āparentā of nothing **]
[** Programming error: tried to test āhasā or āhasntā of nothing **]
You arenāt holding that.
The culprit line is: if (parent(not_holding) has container)
so I added the following debugging code before it: print "noun = ", noun, ", not_holding = ", not_holding, "^";
This revealed some interesting results. In the majority of cases that I tested, noun returned 0 and not_holding returned n, where n is an object number. However, in one case, it was the reverse, so there is no way that the test is going to work in all cases. More specifically, I had a key in a glass. GIVE KEY TO MAN returned noun = 0, not_holding = 238110 and DROP KEY returned noun = 238110, not_holding = 0.
I have reverted to the code as it was in version 6.12.3 and everything works fine.