[Solved] gRestoreGame GUI problem

Started by actaria, Sat 29/10/2022 08:46:46

Previous topic - Next topic

actaria

Hello,

I just did customs GUI for
gSaveGame
and
gRestoreGame

It was not that easy to make evrything work well but now it does except the fact that when i open gResoreGame i can only choose the last game saved and not the older one see the video below

Here is the code i have in:

lstRestoreGamesList_OnSelectionChanged

Code: ags
function lstRestoreGamesList_OnSelectionChanged(GUIControl *control)
{
show_restore_game_dialog();
}

I tried a few things but didn't managed to fix it.
Any help would be appreciated, thank you.


Khris

#1
show_restore_game_dialog(); is a function you would call when the user clicks the "load" button in the menu bar or presses the load shortcut key (like F7).

Calling it inside the list's selection change handler makes no sense because at that point the restore dialog is already visible. What happens is the list gets repopulated, changing the selection back to the first item (the default).

You'll want to restore the selected game instead:
Code: ags
  int index = lstRestoreGamesList.SelectedIndex;
  RestoreGameSlot(lstRestoreGamesList.SaveGameSlots[index]);

To show a youtube video, put just the ID between the tags (remove the space in the first tag):
[youtube ]dbXsg1x-e5w[/youtube]

actaria

It took me a lot of time to make the GUI and understand a  little bit how it works but i would  never have been able to find the solution on that one i think.

You save me once again  Khris, thank you so much plus you take time to explain how it works and the mistake i made this is really kind.

So thanks again  :-D  and regarding to the youtube video i checked and i have no space in the first tag but when i click on the video it says an error as occurred.

I already posted a video on the forum and it was working.

eri0o

You have to use only the video id, it's the code between v= and the next & in the URL

actaria

Quote from: eri0o on Sat 29/10/2022 15:35:07You have to use only the video id, it's the code between v= and the next & in the URL

O yes thank you eri0o it's working now  :)

SMF spam blocked by CleanTalk