Basic Screen Effects: "Wait for any key" is printing the key that was pressed

With this code, at the second “Wait for any key,” the game prints the thing you type. So for example, if the player types a “P,” a “P” will appear on the screen.

"Game Title" by Author

Include Basic Screen Effects by Emily Short.

Lab is a room.

When play begins:
	say "Here is some introductory text.";
	wait for any key;
	clear the screen;
	say "Here is some more text.";
	wait for any key.

This is what the screen looks like after the player has typed “P”:

Here is some more text.
P
Game Title
An Interactive Fiction by Author
Release 1 / Serial number 240706 / Inform 7 build 6M62 (I6/v6.33 lib 6/12N) SD

Lab

>

I’m not sure if this is supposed to happen or not, but it almost makes it look like a bug in the game. What would be the best way to avoid it?

Also, if I change the “When play begins” rule to say just this, it does not print the letter that the player typed:

When play begins:
	say "Here is some introductory text.";
	wait for any key.

But I do want to be able to clear the screen.

I think the problem is that you don’t have “clear the screen” after that second “wait for any key.”

If you want the “more text” to stay on the screen when the game properly starts, get rid of the second “wait for any key”.

1 Like

If I comment out the “clear the screen” line, the letter doesn’t print either time:

When play begins:
	say "Here is some introductory text.";
	wait for any key;
	[clear the screen;]
	say "Here is some more text.";
	wait for any key;

It’s printing the letter only if I’ve cleared the screen first, and I don’t know why.

I’d like to be able to keep both pauses, but only clear the screen after the first one.

Again, just get rid of the second “wait for any key.”

When play begins:
	say "Here is some introductory text.";
	wait for any key;
	clear the screen;
	say "Here is some more text.[paragraph break]".

This allows the first screen clear and leaves the “more text” just above the game banner stuff and first room. Is that what you want?

Oh, I see you want to keep the pause. But you want to keep the text above the banner? Is that right?

Huh. When I use your code I don’t have a problem at all. So there’s nothing wrong with your code that I can see. Weird.

For what it’s worth, I do see this happen in the Inform 7 IDE story player but I don’t see it happen in the actual compiled game file.

1 Like

It’s not happening there for me. I’m still on the old Inform. Is this a thing with v10?

Great question! I tried setting the various settings in the IDE to past versions (9.3, 9.2) and I still see it. However, I do notice that this does not happen in the Mac version of the IDE. It’s only happening in the Windows one as far as I can see.

1 Like

There you go. I’m on a mac.

I’m seeing it in the Windows IDE, version 6M62. I don’t have version 10 installed.

Same here–when I open the released game in Lectrote and Windows Glulxe, I don’t see the “P.”

So maybe I don’t have to worry about this showing up in the released version.

David Kinder has filed this as a bug in the Windows front-end of Inform 7:

Story tab incorrectly prints result of character input · Issue #76 · GitHub

1 Like