weewonder / garglk

Automatically exported from code.google.com/p/garglk
Other
0 stars 0 forks source link

Text not printed to main text window when called from glk timer event #155

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Garglk does not print text to the main text-buffer window in a Glulx Inform 
when that text is generated by a timer event. It *will* print such text to a 
text-buffer window other than the gg_mainwin window created by the Inform 
library.

(Gargoyle 2010.1 on Mac OS X.)

Here's a small I7 game that will reproduce the problem:

Include Glulx Entry Points by Emily Short.

To start a timer:
    (- glk_request_timer_events(200); -)

When play begins:
    say "A timer should tick every 200 milliseconds, starting now, and print some text to the screen each time.";
    start a timer.

A glulx timed activity rule:
    say "Timer tick."

There is a room.

Original issue reported on code.google.com by Ek.Temple@gmail.com on 13 Jul 2011 at 2:00

GoogleCodeExporter commented 8 years ago
You have to cancel the pending line request in the main window before you can 
print anything there.

http://eblong.com/zarf/glk/glk-spec-072_4.html#s.2
"It is illegal to print anything to a window which has line input pending. 
[This is because the window may be displaying and editing the player's input, 
and printing anything would make life unnecessarily complicated for the 
library.]"

Original comment by bcressey@gmail.com on 13 Jul 2011 at 5:35

GoogleCodeExporter commented 8 years ago
Ah yes, thanks for the reminder, Ben--sorry to waste your time. This is yet 
another instance of more permissive libraries changing expectations...

Original comment by Ek.Temple@gmail.com on 13 Jul 2011 at 6:24

GoogleCodeExporter commented 8 years ago
The Inform 7 IDE on the Windows side also lets you print to a text buffer that 
is awaiting line input, which is unfortunate.

You can get the desired behavior legally using glk_set_echo_line_event(), 
canceling line event when the timer fires, printing the desired text to the 
buffer, then requesting line input again with the saved buffer.

But that's a lot of work and many people won't bother if the tools don't 
enforce it.

Original comment by bcressey@gmail.com on 13 Jul 2011 at 9:45