Printing a character after the prompt

I have a situation where I’m using printing out a series of lines of dialogue with a pause between each line using code that largely borrows from Real-Time Delays by Erik Temple.

As those lines of dialogue appear, no prompt is given. But if the player presses a key, the code provides a prompt and continues showing it after every line of dialogue. I accomplished this by using the code Erik Temple posted here:

The problem I was having is that whatever key the user pressed to interrupt the timer, the corresponding character was lost. So if the play typed “look at window” it would come out as “ook at window”

I fixed this by editing Erik’s code so that the key pressed is stored in a buffer:

[ WaitDelay key ix;
	while (wait_flag) {
		ix = HandleGlkEvent(gg_event, 1, gg_arguments); 
		if (ix >= 0 && gg_event-->0 == 2)
			key = gg_event-->2;
			stored_buffer->WORDSIZE = key;
			stored_buffer-->0 = 1;	
			stop_loop_flag = 1;
			wait_flag = 0;	

that character gets displayed after the prompt via this:

[code]To re-request line event in main window:
	(-  glk_request_line_event(gg_mainwin, stored_buffer + WORDSIZE, INPUT_BUFFER_LEN - WORDSIZE, stored_buffer-->0); -)

I’m just doing this by trial and error… I’m far from understanding Glulx.

The problem I’m running into is that for some reason the character that’s being added after prompt is not bolded. So the player’s text ends up looking like this:

> look at window

The code Erik posted at doesn’t have that problem, so I’m a bit mystified.

I’d appreciate any thoughts folks have (up to & including “stop messing around in code you don’t understand!” :slight_smile:

This sounds like it could be a bug in your interpreter (Glk implementation). What happens if you try it in a different interpreter, such as Gargoyle?

Failing that, it might help if you posted a complete code example.


It must’ve been some intermittent bug… I can no longer reproduce the problem.