Hm, I’ve error trapped the bug to occuring before I deliver a single one of my own ‘when play begins’ rules in the source. This suggests to me it happens in the ‘when play begins’ of an extension. So I went through all the extensions. There aren’t actually many ‘when play begins’ rules in them, and some that are there are inoffensive.
The only possible guilty party I could find was Flexible Windows. It has 4 rules:
When play begins (this is the allocate rocks rule):
let cnt be 200;
repeat with item running through g-windows:
if the rock-value of item is 0:
set item rock to cnt;
increase cnt by 10;
now the direct parent of item is the direct-parent of item;
set main-window ref.
[code]Section - Validating rock numbers (not for release)
When play begins (this is the rock validation rule):
repeat with item running through g-windows:
let L be the list of g-windows;
remove item from L;
repeat with compared running through L:
if the rock-value of item is the rock-value of compared:
say “***Warning: There appears to be a conflict in the rock numbers of the g-windows ‘[item]’ and ‘[compared]’. Assign all rock-values for custom windows manually to remedy this problem. Avoid using 201 or 202, as these are reserved.”;
stop.[/code]
When play begins when the main-window is a bordered g-window:
apply borders to main-window.
When play begins (this is the initial hyperlink request rule):
request glulx hyperlink event in the main-window;
request glulx hyperlink event in the status window.
I was able to disable the last rule as a test and run the game, which still worked but still had the bug.
I should point out the status window is formed by splitting the root glk window, thanks to a bit of code by David Kinder. If I understand things right, on an initial boot of the game, this happens in the context of an absence of windows. But after a restart, various windows still exist, even if they’re closed. (I don’t understand why everything isn’t destroyed when the player types RESTART, but I’m not a low level Inform programmer.)
Could the bug be related to the game running through Flexible Windows again on the reboot, and something in there is cranky about the irregular nature of the status window?