Inform6: Printing with the Input style

I feel like I used to be able to choose “Authoring Inform 6 / 7” for the category… Hmm…

Anyways, hello! I’m playing around with echoing input in different ways and I read this:

void glk_set_echo_line_event(winid_t win, glui32 val);
Normally, after line input is completed or cancelled in a buffer window, the library ensures that the complete input line (or its latest state, after cancelling) is displayed at the end of the buffer, followed by a newline. This call allows you to suppress this behavior. If the val argument is zero, all subsequent line input requests in the given window will leave the buffer unchanged after the input is completed or cancelled; the player’s input will not be printed. If val is nonzero, subsequent input requests will have the normal printing behavior.

[Note that this feature is unrelated to the window’s echo stream.]

res = glk_gestalt(gestalt_LineInputEcho, 0);

Not all libraries support this feature. This returns 1 if glk_set_echo_line_event() is supported, and 0 if it is not. [Remember that if it is not supported, the behavior is always the default, which is line echoing enabled .]

If you turn off line input echoing, you can reproduce the standard input behavior by following each line input event (or line input cancellation) by printing the input line, in the Input style, followed by a newline in the original style.

The glk_set_echo_line_event() does not affect a pending line input request. It also has no effect in non-buffer windows. [In a grid window, the game can overwrite the input area at will, so there is no need for this distinction.]
Can be found at: Glk: A Portable Interface Standard for IF

So, I’m trying to figure out how to print with the Input style (see bold&italic text above). It’s not one of the standard Inform styles, so how does one do it?

Thank you!

style_Input is one of the eleven Glk styles.

See Glk: A Portable Interface Standard for IF :

style_Input: Text which the player has entered. You should generally not use this style at all; the library uses it for text which is typed during a line-input request. One case when it is appropriate for you to use style_Input is when you are simulating player input by reading commands from a text file.

You set this with glk_set_style() or glk_set_style_stream().

1 Like

i wonder if this will reliably work across glulx interpreters that have a separate input line, e.g. the HTML ones
…i guess so, as they do print the input in the transcript as well