Custom save/load gui still visible on load

Started by Ezekiel000, Sun 26/08/2012 22:21:58

Previous topic - Next topic

Ezekiel000

I created my own custom gui for saving/loading but when I restore a saved game the save/load gui is still visible.
How can I get it to save but not hide the gui, but when I load the saved game have the gui not visible?

I'm currently saving with:
Code: AGS
function SaveGame(int slot)
{
  String slot_name;
  slot_name = slot_name.Append(RoomName);
  slot_name = slot_name.Append(", ");
  slot_name = slot_name.Append(Progress);
  
  gSaveload.Visible = false;
  gLabel.Visible = false;
  mouse.Mode = old_mouse_mode;
  SaveGameSlot(slot, slot_name);
  if(slot == 1) sl_slot1_label.Text = slot_name;
  if(slot == 2) sl_slot2_label.Text = slot_name;
  if(slot == 3) sl_slot3_label.Text = slot_name;
  if(slot == 4) sl_slot4_label.Text = slot_name;
  if(slot == 5) sl_slot5_label.Text = slot_name;
  if(slot == 6) sl_slot6_label.Text = slot_name;
  gSaveload.Visible = true;
  old_mouse_mode = mouse.Mode;
  mouse.Mode = eModePointer;
}


And loading with:
Code: AGS
function LoadGame(int slot)
{
  RestoreGameSlot(slot);
  gLabel.Visible = false;
  gSaveload.Visible = false;
}

Khris

Both SaveGameSlot and RestoreGameSlot aren't executed until the current function finishes.
In other words, everything in your SaveGame function below SaveGameSlot() is actually executed before the game is saved.

Thus the saved game stores the GUI as being visible, and the LoadGame function turns the GUI invisible, then restores the savegame, thus making it visible again.

I guess you want the GUI to stay visible after the player saved their game, right?
Just use on_event / eEventRestoreGame to turn it off after loading.
(And you can remove all the gSaveload.Visible = false/true; calls from your functions.)


Miori

Thanks too ^_^

Even if I needed a while until I found out how this on_event stuff works XD

SMF spam blocked by CleanTalk