inserting code after a successful restore

What normally happens after you restore a game is: nothing. The game prints “Ok,” and there is no obvious sign that anything in the game world has changed, except for (maybe) a change in the status line.

What I would like to happen is: the screen clears, and the game prints the room description, as if the player had just typed LOOK.

I can’t figure out how to make this happen, though. Adding more carry out rules to the “restoring the game” action doesn’t seem to work, and you can’t write after rules for an out-of-game action.

Any ideas on how to do this? Is this something where you’d have to hack into the interpreter?

Assuming you’re using Glulx:

[code]The output from restoring rules are a rulebook.

The last output from restoring rule (this is the default restoring the game rule):
rule fails.

Output from restoring:
say “[bracket]Saved file successfully restored.[close bracket][paragraph break]”;
try looking;
rule succeeds.

Include (-

[ RESTORE_THE_GAME_R res fref;
if (actor ~= player) rfalse;
fref = glk_fileref_create_by_prompt($01, $02, 0);
if (fref == 0) jump RFailed;
gg_savestr = glk_stream_open_file(fref, $02, GG_SAVESTR_ROCK);
glk_fileref_destroy(fref);
if (gg_savestr == 0) jump RFailed;
@restore gg_savestr res;
glk_stream_close(gg_savestr, 0);
gg_savestr = 0;
.RFailed;
GL__M(##Restore, 1);
];

-) instead of “Restore The Game Rule” in “Glulx.i6t”.

Include (-
[ SAVE_THE_GAME_R res fref;
if (actor ~= player) rfalse;
fref = glk_fileref_create_by_prompt($01, $01, 0);
if (fref == 0) jump SFailed;
gg_savestr = glk_stream_open_file(fref, $01, GG_SAVESTR_ROCK);
glk_fileref_destroy(fref);
if (gg_savestr == 0) jump SFailed;
@save gg_savestr res;
if (res == -1) {
! The player actually just typed “restore”. We’re going to print
! a successful restore message; the Z-Code Inform library does this correctly
! now. But first, we have to recover all the Glk objects; the values
! in our global variables are all wrong.
GGRecoverObjects();
glk_stream_close(gg_savestr, 0); ! stream_close
gg_savestr = 0;
if ( FollowRulebook( (+ output from restoring rules +) ) && RulebookFailed())
{
return GL__M(##Restore, 2);
}
return;
}
glk_stream_close(gg_savestr, 0); ! stream_close
gg_savestr = 0;
if (res == 0) return GL__M(##Save, 2);
.SFailed;
GL__M(##Save, 1);
];

-) instead of “Save The Game Rule” in “Glulx.i6t”.[/code]

Note that the standard message (“OK”) will be printed if the output from restoring rules end in failure. Otherwise, only what you place in the output from restoring rules will be printed.

–Erik

That is perfect. Thank you!