I have some unpublished Inform 6 games that I’m thinking of porting to PunyInform. Most of these have a few custom messages to replace those supplied by the standard library. The first one I encountered is the response to the SCORE command when the game doesn’t have any scoring. With the standard library, I do this:
Constant NO_SCORE;
Object LibraryMessages
with
before
[;
Score:
if (lm_n == 2)
"There's no score in this game. Your objective is to blah...blah.";
];
If I declare the NO_SCORE
constant in PunyInform, the SCORE command is not understood at all. Personally, I think this is wrong. It should just print a default message and allow you to overwrite the default message if you choose to, the same as the standard library.
So, let’s omit the declaration of the NO_SCORE
constant and replace the PunyInform response. After experimenting with the static strings and dynamic strings for the custom library messages, the closest I could get was this:
Constant MSG_SCORE_DEFAULT 1000;
[ LibraryMessages p_msg p_arg_1 p_arg_2;
switch (p_msg)
{
MSG_SCORE_DEFAULT: "There is no score in this game. Your objective is to blah...blah.";
}
p_arg_1 = p_arg_2;
];
This prints the desired message, but then prints an extra period on the next line. What the?
After trawling through grammar.h
, I found that ScoreSub
was responsible for printing the default message (as expected), but it doesn’t print the extra period:
[ ScoreSub;
PrintMsg(MSG_SCORE_DEFAULT);
PrintRank();
];
It’s the code for PrintRank
that looks a bit iffy:
#Ifndef NO_SCORE;
#Ifndef PrintRank;
[ PrintRank; "."; ];
#Endif;
#Endif;
I did not have the PrintRank
entry point routine defined, but it went ahead and tried to execute it anyway, then printed a period. This looks like a bug to me. #Ifndef
should be #Ifdef
and it should not print the trailing period. That is the responsibility of the PrintRank
routine.
EDIT: I spoke too soon. I should have tested this first. I think I can see what it’s trying to do. If the PrintRank
routine is not defined, then it defines it and all it does is print a period. This is certainly not the right thing to do. A better solution would be to modify the ScoreSub
routine as follows:
#Ifndef NO_SCORE;
[ ScoreSub;
PrintMsg(MSG_SCORE_DEFAULT);
#Ifdef PrintRank;
PrintRank();
#Endif;
];
#Endif;
Please feel free to correct me if I’m wrong, as I probably am wrong.
While trawling through grammar.h
, I also found an issue with the grammar for FULLSCORE:
Verb meta 'fullscore' 'full'
* -> FullScore
* 'score' -> FullScore;
This expands to 'fullscore'
, 'full'
, 'fullscore score'
and 'full score'
. I’m being pedantic, but the third one is incorrect.