I have a GUI for restoring save games that works perfectly, except for one detail. These are snippets of their codes:
This is the function that makes appear the GUI:
function show_restore_game_dialog()
{
gRestoreGame.Visible=true;
gRestoreGame.X=(Screen.Width-gRestoreGame.Width)/2+500;
gRestoreGame.Y=(Screen.Height-gRestoreGame.Height)/2;
Mouse.UseDefaultGraphic();
// get the list of save games
gRestoreList.FillSaveGameList();
if (gRestoreList.ItemCount > 0)
{
// if there is at least one, set the default text
// to be the first game's name
gRestoreText.Text = gRestoreList.Items[0];
}
else
{
// no save games yet, so default to empty text
gRestoreText.Text = "";
}
}
This is the code I use for restoring a savegame:
function btnRestoreGame_OnClick(GUIControl *control, MouseButton button)
{
if (gRestoreList.ItemCount<=0)
{
player.Say("No hay ninguna partida guardada");
cerrar_gui_propietaria(control);
}
else
{
if (gRestoreList.SelectedIndex >= 0)
{
//cerrar_gui_propietaria(control);
RestoreGameSlot(gRestoreList.SaveGameSlots[gRestoreList.SelectedIndex]);
}
}
}
The rest of the codes I think are not relevant.
When I test the game and record a game, it is perfectly recorded. If I use these routines to recover one of the saved games, it works too but....it fades-in to black, and the screen stays black permanently....until I press a key or the cursor mouse, so that with a fade-out the correct scene appears and the game continues without problem.
How can I avoid the need to have to press the mouse or a key for the process of restoring a game to be done perfectly?
Quote from: PERXEO on Wed 10/05/2023 14:35:19When I test the game and record a game, it is perfectly recorded. If I use these routines to recover one of the saved games, it works too but....it fades-in to black, and the screen stays black permanently....until I press a key or the cursor mouse, so that with a fade-out the correct scene appears and the game continues without problem.
How can I avoid the need to have to press the mouse or a key for the process of restoring a game to be done perfectly?
This is not a normal behavior.
How is your game saved, in which moment exactly and what script do you use?
Do you have any commands in on_event function under eEventRestoreGame?
oh, thanks in order to check it it works I had this:
function on_event(int event, int data)
{
if (event == eEventRestoreGame)
{
// Display("DATA %d ", data);
}
}
but if I remove it, it works!!! Thanks!!! Very useful, as usual!!