I have noticed something weird. At the end of the compilation message, I get the line
Error: No such constant as “Recall”
and the report that the code was compiled with 1 error (which is that one above).
So, I get a z5 file out of it, and everything works as it should, including the object marked as faulty.
So, if the error does not impact the actual code created, do I have to worry about it?
The involved items are the new verb “Recall“ and my class definition for persons, which comes with an orders property redirecting “person, Recall x“, to “ask person about x“, so that all persons automatically understand the command to recall something as them being asked about it. As I said, everything works properly in the z5 file, so I don’t see any impact of that error message.
Or is there a way to solve this issue (which seems to stem from the class definition being given before the verb definition as seems to be the correct order for Inform)?
And I already tried putting the class definition back into the main file, but that does not solve the problem. The error occurs both when the class is in the include file and when the class definition is in the main file together with the verb, so it is definitely not the include that causes it.
I am not an experienced programmer in Inform, and my last attempt in it was years ago, so it could very well be something extremely basic/obvious. So, if there is a dumb mistake that could be the cause of this, feel free to mention it, as it may very well be the case.
Is there some pre-declaration of verbs I can or should do? Or some means to reserve the constant for the verb declaration?
I just tested something. I commented out the offending part in the class definition (since it is just part of orders, removing it has no impact on the rest of the game). If I compile it after that change, I get the same error message, this time pointing to the next instance of Recall, this time as part of the before property of an actual object in the main file. So, it seems to always complain about the first instance Recall appears in the code.
And commenting out the lines in the orders property of Person does indeed change the behaviour of NPCs (instead of sending the action to the ask about routine, it just deals out the standard ‘xxxx has better things to do.’). So, I can now say for sure that despite the error message, the orders property of the Person class works correctly handling Recall.
So, I put RecallSub directly after include "VerbLib";
(the standard library of Inform 6.42) and before include "HealMiaClasses.inf";
which is actually the next active code and includes the Person class. Unfortunately, it did not change anything, the error still occurs complaining about the Person class as before.
Really odd. But thank you for the suggestion.
Yours,
Deathworks
EDIT: I just checked in the IBG, and the way Captain Fate adds the Change command is, as far as I can see, identical to how I have added Recall. I am really at a loss as to what I am missing.
I’ve tried a test case using your Recall verb definition, and I’m afraid I can’t reproduce this error. I tried a few different placements of the Verb and RecallSub declarations.
Is the symbol Recall maybe being used somewhere else in your code?
Here is the culprit at line 1557 of the main file!:
[discussiontopic x;
switch (scope_stage)
{
1:
return false;
2:
objectloop(x has discussable)
PlaceInScope(x);
if ((action_to_be == Recall) && (actor == player))
return true;
objectloop(x in location)
PlaceInScope(x);
objectloop(x in player)
PlaceInScope(x);
objectloop(x ofclass Item)
if ((((x hasnt concealed) && (x hasnt scenery)) || (x has moved)) && (parent(x) ~= nothing) && (parent(x) in location))
PlaceInScope(x);
return true; ! This ensures that only discussable things can be discussed
3:
print "^I am not sure how that is relevant at the moment.^";
};
];
I forgot the ## there. Once I put the ## there, the error message disappeared. But it is really annoying that the error message pointed at a completely innocent part of the code.
Thank you for helping me find that!
Yours,
Deathworks
EDIT: And comparing the two versions, it turns out that the buggy version actually makes more sense - in other words, removing the if statement improves the responses of the game.
I am glad we figured it out.
I don’t know how important it is, just for your information: Recall was used in the class definition and in the objects several times correctly, then came the faulty code, and shortly thereafter RecallSub and the Verb command. So, while the actual faulty code was towards the end of the file, the error pointed to the first (innocent) instance of the word instead.
EDIT: And it went unnoticed for quite a while, because normally, error messages come before the statistics when I compile. This is the only time I have seen an error message after the statistics (like warnings).