Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Andrea1992 on Wed 04/11/2020 10:20:36

Title: GUI sound playing on game restore
Post by: Andrea1992 on Wed 04/11/2020 10:20:36
Hi,
When I save a game and hit the save button, a button sound is played with the click, which is OK  (nod).
But then, when I restore that saved game, the button sound is played again after fade in the room  (wrong).

As you can see below, I just added a normal playing sound when clicking the save button.

Code (ags) Select

function btnSaveGame_OnClick(GUIControl *control, MouseButton button)
{
  a138_Barra_Select.Play();  // this is the audio when clicking the button 'save'

  int gameSlotToSaveInto = find_save_slot(txtNewSaveName.Text);
  if (gameSlotToSaveInto < 0)
  {
    Display("No more free save slots!");
    return;
  }
  SaveGameSlot(gameSlotToSaveInto, txtNewSaveName.Text);
  close_save_game_dialog();
}


I don't know why is playing that sound again when i restore the game. Thanks in advance.
Not sure if I explained my self
Title: Re: GUI sound playing on game restore
Post by: Khris on Wed 04/11/2020 11:37:27
Try adding a  Wait(40);  at the end of the function, to give the sound time to end before the game is actually saved. Increase the number if necessary.
Title: Re: GUI sound playing on game restore
Post by: Andrea1992 on Wed 04/11/2020 12:14:41
 :-D That worked. Thanks