Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Mikhail on Mon 02/04/2012 18:42:07

Title: Custom 'Game Saved' GUI Problem
Post by: Mikhail on Mon 02/04/2012 18:42:07
I just create a custom GUI that include the label 'Game Saved' and display it when player save the game.

I use the Transparency property (GUI) option too to display it when that GUI visible when player click the savegame btn on gSaveGame GUI.

The problem is,when i try to save the game when no current savegame data,the GUI display nicely,but when i try it to save for the second times when including the current savegame (whether to overwrite save game or create other new save game) the GUI not display anymore..

What's wrong?what the mistakes?

Below are the scripts that i use for;


function btnSaveGame_OnClick(GUIControl *control, MouseButton button)
{
  int gameSlotToSaveInto = lstSaveGamesList.ItemCount + 1;
  int i = 0;
  while (i < lstSaveGamesList.ItemCount)
  {
    if (lstSaveGamesList.Items[i] == txtNewSaveName.Text)
    {
      gameSlotToSaveInto = lstSaveGamesList.SaveGameSlots[i];
    }
    i++;
  }
  SaveGameSlot(gameSlotToSaveInto, txtNewSaveName.Text);
  close_save_game_dialog();

  gGameSaved.Visible = true;              // custom code that i used starting here
  gGameSaved.Centre();
 
  int trans = gGameSaved.Transparency;
  while (trans < 100) {
  trans++;
  gGameSaved.Transparency = trans;
  Wait(1);
}
   gMenu.Visible = true;
   gArrow.Visible = true;
 
  mouse.UseModeGraphic(eModePointer);    // end of my custom codes

}


Sorry for my bad English.
Title: Re: Custom 'Game Saved' GUI Problem
Post by: Khris on Mon 02/04/2012 20:29:35
This should do it:


  ...
  gGameSaved.Centre();              // custom code that i used starting here
  gGameSaved.Visible = true;
 
  int trans = gGameSaved.Transparency;
  while (trans < 100) {
    trans++;
    gGameSaved.Transparency = trans;
    Wait(1);
  }
  gGameSaved.Visible = false;
  gGameSaved.Transparency = 0;        // reset transparency to 0

  gMenu.Visible = true;
  gArrow.Visible = true;
 
  mouse.UseModeGraphic(eModePointer);    // end of my custom codes
}


(You have to reset .Transparency to 0. I also changed the order slightly so the GUI is centered before it is shown.)