No such constant as "Recall" - compiled with 1 error - Do I have to worry?

Hello,

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)?

Yours,

Deathworks

If you paste the class and the verb definition here, it’s easier to have an idea what’s going on.

You should not ignore this error. Somewhere you use the constant RECALL that don’t have the value you assume.

I’m just guessing here, but if Recall is an action, might you have used it as Recall, rather than ##Recall?

Hello,

Here are the relevant parts:

Class  Person
    class   DiscussionTopics Item,
    with    orders [;
 	                Ask:
					    <Tell self second>;
						return true;
					Examine:
					    <Show noun self>;
						return true;
                    Recall:
			            <Ask self noun>;
			 	        return true;
					Sorry:
					    <Apologise self>;
						return true;
		           ],
	        ToldAbout 0,
			ToldAboutThing 0,
    has     animate;

And at the end of the program:

Verb  'remember' 'recall' 'consider'
    *  scope = discussiontopic -> Recall;

The error points to the Recall: line in the orders property.

Yours,
Deathworks

Dumb question, but are there a RecallSub routine?

Hello,

Yes, there is, shortly above the verb definition and long after the class, of course.

[RecallSub;
!    if (noun ~= player)
!	    {
!		    <Ask noun second>;
!			return true;
!		};
    if (second == nothing)
	    {
		    second = noun;
			noun = player;
		};
    if (noun ~= player)
	    {
		    print "^", (The) noun, " doesn't know anything about ", (the) second, ".^";
	        return true;
		};
    print "^You don't recall anything noteworthy about it.^";
   	return true;
];

Apologise is also a new verb, but it doesn’t complain about that.

Yours,
Deathworks

Hello

And here is a screen shot of the error message:

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.

Yours,
Deathworks

What is line 364 in the source ?

Best regards from Italy,
dott. Piergiorgio.

Hello,

Line 364 is just Recall:
Here is the screenshot:

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?

Yours,
Deathworks

Hello!

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.

Yours,
Deathworks

Try to compile RecallSub prior of the class Person ?

(IIRC, Inform 6 has forward-referencing, but I prefer erring in overtesting…)

Best regards from Italy,
dott. Piergiorgio.

Hello,

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?

Hello,

Yes, you solved it!

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. :sweat_smile:

3 Likes

I’ll file that as a bug. It may be hard to do anything about it, though.

Thanks for confirming what the problem was.

Hello,

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).

Yours,
Deathworks

I was able to simplify the buggy case: Incorrect line number in "no such constant" error · Issue #323 · DavidKinder/Inform6 · GitHub

3 Likes