FatalError in YesOrNo

I’ve run into a FatalError in Kerkerkruip, and can’t figure out what the cause is: “Fatal Error: Printing text to a window that is waiting for line or character input is not allowed.”

It happens only for YesOrNo, not normal text input. Most commands will work, but something like Restart will cause the error.

But, it happens only when restoring/continuing a game. So to test it, you’d have to start a game, restart with the “restart now” command, and then continue the previous game. It also happens only in the Windows IDE, not Gargoyle or WinGit.

I’ve tried adding extra input cancelling calls just to be safe, but it hasn’t helped yet.

Any ideas on how I could track down this bug?

Is the game trying to play music? If so, take a look at this thread.

Nope, no music. And if something like that was the cause, wouldn’t it affect all text input?

Is it a Glk error? I just started using Glk and your error msg sounded familiar.

I found the following in section 4.2 of the Glk spec:

Section 4.2 is quite lengthy, maybe there is a solution in there?

It is a Glk error yes, but a strange one, because as far as I can tell, nothing is trying to be printed while YesOrNo() is running.

From your last reply I understand that you are requesting line or char input but someone else is trying to print to the active window?

I studied Zarf’s yes_or_no() routine in his model.c example. If you are using similar code, would it be possible to comment out the glk_request_line_event() call (and maybe some more) so that you can catch the string that is trying to be printed? Maybe you can tell from the contents of the string where it is coming from?

Doesn’t restarting trigger playing the theme music - it seems that this is only played when the game is started or restarted?

I recall one of these errors came up (in a recent discussion) because invoking a rulebook caused I7’s linebreak mechanism to print a linebreak, at a point before a cancel_line_event call.

Marnix, it works fine in other cases, it’s only Inform 7’s YesOrNo, that’s what’s so strange. I tried returning early from that function before actually requesting the input, but nothing is printed.

Turnip, nope, the theme music is already stopped.

Zarf, hmmm, that could be it. I’ll investigate. Anyone know if any rules are run specifically for YesOrNo?

Nothing specific. Other way around, I guess – YesOrNo is a stripped-down version of the normal line-input code path.