Clearing main window after Enter and then display last command and response

I’m investigating how to clear out the main window after a command is typed and then display only the typed command and its response.

For example, say I’ve said hello to a character in the room and receive this response.

>say hello to humboldt
Dr. Humboldt returns your greeting and waits expectantly.

>

I would like to type my next action.

>say hello to humboldt
Dr. Humboldt returns your greeting and waits expectantly.

>ask humboldt about time travel

And then, when I hit Enter, the entire window would be cleared and the last command would be displayed along with the response to that command.

>ask humboldt about time travel
"Science fiction, if you ask me."

If I add clear the main window; to Every turn: this will happen

>say hello to dogman

[Typing Enter clears the main window and then displays the text below]

You have nothing specific in mind to discuss with Dogman just now.

>

Instead I’d like this to be displayed after Enter is typed.

>say hello to dogman
You have nothing specific in mind to discuss with Dogman just now.

In previous Inform 7 coding for this game I had to examine the current action in an if/else statement to trap and examine player actions in Rule for refreshing blocks to update the user interface windows appropriately (I’m using the Flexible Windows extension in this game).

I assume I’ll have to do something similar for clearing the main window and then displaying the last command and its response, but I wanted to post here while I try and figure this out in case anyone else has tried something similar in the past.

How about:

After reading a command:
    clear the main window;
    say "[command prompt][player's command][line break]".
3 Likes

@Draconis - That worked (and has the benefit of being much more modular and elegant than I could have hoped).

Using this code:

After reading a command:
	clear the main window;
	say "[command prompt] [bold type][player's command] [roman type][line break]";

On this screen, when you type say hello to montgomery into the parser and press Enter:

The main window is cleared and this is printed:

Thank you!