bg
(bg)
July 19, 2024, 12:07am
2
Ok, I pasted in this code from another thread
Chapter - Fix (Inform 6_34)
Section - Fix for incorrect snippet generation when UnknownVerb() returns 'no.verb' and command of form 'Darcy, splendid coat' is diverted to ##Answer, by correct reset of verb_wordnum
Include (- Replace UnknownVerb; -) after "Definitions.i6t". [run our new routine instead]
Include (- [UnknownVerb; verb_wordnum--; return 'no.verb'; ]; -) [move verb_wordnum back to 0 if still searching for verb as first word of command, or back to the comma if a command like 'Darcy, ....'] after "Output.i6t". [make sure it comes after the original UnknownVerb in the output I6. (- Replace MyFunction [OldMyFunction]; -) must precede any declaration of MyFunction() but may be followed by any number of subsequent declarations of MyFunction(). The MyFunction chosen to compile will be the last-defined version, except that definitions in normal files are always preferred over definitions in System_file files or the veneer. With the two-parameter form (introduced in 6.33), the declaration chosen to be renamed and compiled as OldMyFunction will be the first-declared version of the function.]
Section - Fix for comma being erased from chained commands to NPC following a 'no.verb' command (eg test case [11]) by nudging verb_wordnum forward by 1, past the comma
Include (-
if ((held_back_mode) && (verb_wordnum ~=0)){
wn = verb_wordnum;
if (NextWordStopped() == comma_word) verb_wordnum++;
};
-) before "Parser Letter A" in "Parser.i6t".
Section - Fix for failure to consider 'no.verb' grammar lines when no grammar lines match for a detected verb
[if we've reached this point all grammar lines for the recognised verb have failed, so if we haven't tried 'no.verb' and UnknownVerb() returns 'no.verb'- indicating at least some 'no.verb' grammar lines, try those]
Include (- if ((verb_word ~= 'no.verb') && (verb_word =UnknownVerb(verb_word))) jump VerbAccepted; -) after "Parser Letter G" in "Parser.i6t".
Section - Bonus Fix Inappropriate RTP error generated by 'when the topic understood includes __' when the topic understood is "" eg after 'Darcy,' which generates ##Answer action with parsed_number 300
Include (- Replace SnippetIncludes; -) after "Definitions.i6t".
Include (-
[ SnippetIncludes test snippet w1 w2 wlen i j;
w1 = snippet/100; w2 = w1 + (snippet%100) - 1;
if ((w2<w1) || (w1<1)) {
if ((w1 == 1) && (w2 == 0)) rfalse; ! #### pre-existing special-case for snippet of 100
! ##### Insertion
!print "w1=",w1," w2=",w2,"^";
if ((snippet%100) == 0) rfalse; ! 100, 200, 300 etc. i.e. snippet is ""
! ##### Insertion ends
return RunTimeProblem(RTP_INCLUDEINVALIDSNIPPET, w1, w2);
}
if (metaclass(test) == Routine) {
wlen = snippet%100;
for (i=w1, j=wlen: j>0: i++, j-- ) {
if (((test)(i, 0)) ~= GPR_FAIL) return i*100+wn-i;
}
}
rfalse;
];
-) after "Output.i6t".
and the error went away.
I don’t really understand it, though. Or if I’m doing something extra risky by adding in I6 code that I don’t understand what it does.
Edit:
I’ve now discovered that adding this code makes something else happen that I don’t want to happen. Trying to listen to something that is not present results in “I didn’t understand that sentence” instead of “You can’t see any such thing.”
I tried pasting the code into a new project with just “Lab is a room,” and when I tried listening to something not present, I then got “Glulxe fatal error: Memory access out of range (D0720).”
So…how big of a deal would it be to just leave the original error in there? This one:
[answering Marie that "
[** Programming error: tried to read from -->-1 in the array "parse", which has entries 0 up to 60 **]
marie , hi" - ended without result]