Skipping "wait for any key" when testing

I recognize that this is a very niche thing and there’s likely no solution…

I’m using “Basic Screen Effects by Emily Short” and specifically wait for any key. When I use a test X with... command to test my game, it runs through the sequence automatically, but then pauses whenever it reaches a wait for any key. I have to hit something on my keyboard, and then it resumes going through the game… until it hits another and I have to manually nudge it forward. My game is very long so this is a lot of nudging every time.

Is there a way a test can be set to “auto-press-a-key” when it reaches a wait for any key? Not the end of the world, but would save quite a bit of time.

An example. Use test me to see what I’m talking about.

Include Basic Screen Effects by Emily Short. 

Library is a room. "You've been here many times."

The desk is an closed openable fixed in place container in Library.

Instead of opening desk:
	say "Some text.";
	wait for any key;
	say "Some more text.";
	wait for any key;
	say "Even more text.";
	wait for any key;
	say "The final sentence.".
	
Test me with "open desk".

Could you make an alternate version of the opening desk rule without the “wait for any key” and mark it “not for release”?

3 Likes

Depending on what other things you use Basic Screen Effects for, you could put its inclusion in a section marked “For release only”, and define a fake waiting phrase in a section marked “Not for release”. Then the fake waiting would be used during testing, and the real waiting in the released version.

Example:

Section 1 - Real waiting - For release only

Include Basic Screen Effects by Emily Short. 

Section 2 - Fake waiting - Not for release

To wait for any key:
	do nothing.

Section 3 - The Game

Library is a room. "You've been here many times."

The desk is an closed openable fixed in place container in Library.

Instead of opening desk:
	say "Some text.";
	wait for any key;
	say "Some more text.";
	wait for any key;
	say "Even more text.";
	wait for any key;
	say "The final sentence.".
	
Test me with "open desk".
4 Likes

It’s a thought, but I use wait for any key in a lot of situations. Also, would that work when I just hit “Go” in the program?

Oop. Didn’t see your reply while I was replying to Hanon. Oh neat! That seems to work. Man, that’s really going to save my spacebar.

Blerg. Not working when I put it into my existing game. Not sure how to nail down the conflict, but I’ll plug away at it.

Are you getting any error messages, or in which way is it not working?

One thing to note is that if you release a game, and then later (without changing the source code) press “Go” in the IDE again, then the IDE will play the already compiled, released version in its interpreter, so that the real waiting phrase is used and you’ll have to press space again, even though it’s in the IDE. (It’s also noticeable because “TEST ME” isn’t working then.)
In that case, you’ll need to change something in the source (should be enough to put in a letter and delete it again) and then press Go to recompile.

1 Like

Just in case this is involved: the only way to end header-ed chunks of code (Volume, Book, Part, Chapter, Section) is to start another at the same level or higher. So @StJohnLimbo’s Section 3 - The Game above is a crucial part of the example: without it, the whole rest of the game would be included only in the not for release case (and without Section 3 the example would fail to compile for release since there wouldn’t be a room definition in the release case).

1 Like

When I run a “test me” in the IDE using “Go”, it runs through and still pauses at the wait for any key’s. Changes or no changes.

Hmm, that’s strange, and seems to indicate that it doesn’t use the fake “do nothing” waiting phrase. I’d try to put in some more definitions in both sections (the for-release-only section and the not-for-release section) just to see which one gets picked up.

For example, something like After jumping, say "Release version jumping." versus After jumping, say "Test version jumping." in the respective sections; or Every turn, say "release version". versus Every turn, say "test version".

Good thinking. It’s firing the “not for release” section, so there’s some conflict with the “do nothing”, I guess.

That would mean that it’s picking the right section (for testing, not for release), but it’s still using a phrase from an extension which is only included in a for-release-only section? That is very strange indeed.

What’s the output when you type VERSION in the IDE while testing? It should not list Basic Screen Effects.
Edit: Sorry, Basic Screen Effects uses “authorial modesty”, so it won’t be listed by VERSION anyway. Add:
When play begins, say the complete list of extension credits. to get the complete info.

Not showing “Basic Screen Effects” when I type version into the IDE.

So, I just did a similar thing:

To clear the screen:
	do nothing.

“Clear the screen”, another definition included in “Basic Screen Effects”, DOES get ignored during the test. So what is it about wait for any key that isn’t working here?

Sorry, I just edited my post above. Basic Screen Effects uses “authorial modesty”, so it wouldn’t be listed by VERSION anyway. You can add:
When play begins, say the complete list of extension credits. to get the complete info despite the modesty. It should be listed in the release, but not in the IDE.

Hmm, I’m out of ideas for the moment. Can you try to copy the code into a new separate project and pare it down until you have a minimal example demonstrating the weird behaviour?

Sorry if this was suggested and I missed it - does the “not for release” part need perhaps to be in the extension instead of in the main source text?

Perhaps instead of including it like an extension, copy the source of the extension and put it into a heading in the main source text and mark it “for release only”?

As one possibly simplifying thing toward making a minimal test case: Including Basic Screen Effects doesn’t have to be conditional. While there are many places where Inform balks at re-defining an existing name, it’s fine with re-defining to-phrases. So this alone is a working example of really waiting when compiled for release and not waiting in the not for release case.

Include Basic Screen Effects by Emily Short. [ we always include BSE ]

Lab is a room.
When play begins: say "wait > "; wait for any key;

Part wait (not for release)

[ but in not for release case, we override wait for any key ]
To wait for any key: do nothing. 

(There is one other way to terminate a section without starting another section or higher-level header thing… the end of file.)

Doesn’t need to be; sections (etc.) not for release / for release only and even sections in place of given sections from extensions all work just fine in story.ni.

a design suggestion:

Players sometimes dislike long walls of text, so IMVHO is wise containing the quantity of long/very long texts; OTOH, asking for keypress is a good method for raising suspense, stereotipycal example:

The mad scientist reach the Big Red Button of his Doomsday Machine...
[press a key]

Best regards from Italy,
dott. Piergiorgio.

Good suggestion. Conversely I also get frustrated if the text is doled out line by line and I have to keep pressing a key after every sentence. Text-delays are best used sparingly for the best impact and pacing.