Clicking hyperlinks when game is paused results in error

Hi everyone,

This might be a really simple fix, but I’m coming across an issue, when using hyperlinks in the text with pausing the game.

This is the smallest piece of code that reproduces the issue:

[code]“PauseBug” by Ade McT

Include Basic Hyperlinks by Emily Short.
Include Basic Screen Effects by Emily Short.

Steep Cliff is a room. “A cliff, to the [set link 104]west[end link], looks pretty dangerous.”.

Instead of going nowhere from Steep Cliff when the noun is west:
say “Insta death!”;
pause the game;
say “You are dead.”.

A clicking hyperlink rule (this is the new command replacement by hyperlinks rule):
repeat through the Table of Directional Commands:
if the current link number is linknum entry:
now the glulx replacement command is replacement entry;
rule succeeds;
now glulx replacement command is “”.

Table of Directional Commands
linknum replacement
101 “north”
102 “east”
103 “south”
104 “west”[/code]

…and this is the output:

[code]PauseBug
An Interactive Fiction by Ade McT
Release 1 / Serial number 160717 / Inform 7 build 6L38 (I6/v6.33 lib 6/12N) SD

Steep Cliff
A cliff, to the west, looks pretty dangerous.

west
Insta death!

Please press SPACE to continue. (Clicking ‘west’ again)
Fatal Error: Printing text to a window that is waiting for line or character input is not allowed.[/code]

Basically, if I click a hyperlink while Ii’m paused (or waiting for any key), it reads the click and I don’t know how to switch it off. Is there a simple way to switch off reading hyperlinks while the game is paused?

Thank you for any help on this - it’s driving me mad.

Ade.

This is totally untested, as I don’t have the time right now, but … “Basic Huperlinks” defines a rule “To start looking for hyperlinks” but not one to stop. However, the Glk specification provides calls to start and stop getting hyperlink events, so all that should be needed is a new rule and a bit of Inform 6 to make it make the actual Glk call.

Slightly edited, what is already in Basic Hyperlinks is:

To start looking for hyperlinks:
    (- SetLink(); -)

Include (-
[ Setlink ;
    if (glk_gestalt(gestalt_Hyperlinks, 0))
      glk_request_hyperlink_event(gg_mainwin);
];
-)

So, by analogy (and using what’s in section 9.2 of the Glk spec) what we need to add must be something like this

To stop looking for hyperlinks:
    (- UnsetLink(); -)

Include (-
[ Unsetlink ;
    if (glk_gestalt(gestalt_Hyperlinks, 0))
      glk_cancel_hyperlink_event(gg_mainwin);
];
-)

Then, all that should be needed is something like

Instead of going nowhere from Steep Cliff when the noun is west:
	say "Insta death!";
        stop looking for hyperlinks;
	pause the game;
        start looking for hyperlinks;
	say "You are dead.".	

Works like a charm. Thanks David. Very much appreciated.

Ade.