bcressey wrote:
As a practical matter, you would want to turn off the echo when the game starts. Then just print the player's input after line input events - it comes back to you in the event struct - and discard it when you cancel the line input request.
Example code
here; demo
here.
Aha, thanks!
That linked example is not in the format of an actual game and makes its glk calls with numbers instead of meaningful names (which are luckily mentioned after that in comments) so yeah, I'm having the mother of all headaches right now

, but I guess I have a working (and hopefully not based on an illegal feature if WinGlulxe) example:
Code:
!% -G
!% -D
Include "Parser";
Include "Verblib";
Include "Infglk";
Object Room_01 "Room 01"
with
description
[;
print "You're in Room 01. An exit leads ";
glk_set_hyperlink(1);
print "NORTH";
glk_set_hyperlink(0);
print_ret ".";
],
n_to Room_02,
has light
;
Object Room_02 "Room 02"
with
description "You're in Room 2",
s_to Room_01,
has light
;
[Initialise;
glk_request_hyperlink_event(gg_mainwin);
glk_set_echo_line_event(gg_mainwin,0);
lookmode = 2;
location=Room_01;
];
[HandleGlkEvent ev context abortres newcmd cmdlen;
switch (ev-->0)
{
evtype_hyperlink:
glk_request_hyperlink_event(gg_mainwin);
glk_cancel_line_event(gg_mainwin,0);
newcmd="go north";
cmdlen=PrintAnyToArray(abortres+WORDSIZE,INPUT_BUFFER_LEN-WORDSIZE,newcmd);
abortres-->0=cmdlen;
Command_printing();
return 2;
evtype_LineInput:
Command_printing();
}
];
[Command_printing;
glk_set_style(style_Input);
glk_put_buffer(buffer+WORDSIZE, buffer-->0);
glk_set_style(style_Normal);
new_line;
];
Include "Grammar";
It's probably too late to help Jim, but I didn't want to just forget about it. What it does is:
-Sets echo off at the begining of the game.
-Uses the line input event to manually print the contents of the player input (calling the Command_printing routine)
-After a click is detected, its command is also printed calling the same routine.
Seems to work, though I've hardly tested it! ^_^' any contraindication or just something that could go wrong with this?