Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: on Sat 16/04/2005 14:45:16

Title: Is save game slot used?
Post by: on Sat 16/04/2005 14:45:16
Hi, I've looked through the manual but cannot find the answer to this question.

Basically, I want to have around 6 buttons in a special GUI for saving the game, and another 6 in a GUI for restoring saved games. Clicking these buttons will save or restore a game in the appropriate slot. I can do this without any problems.

I also want the buttons to display a picture for when there is no saved game in the appropriate slot, and display a different picture when a saved game is present in that slot. This is the part I'm confused about. I think I know how to change GUI button images, but how can I make the game check for the prescence of the saved games?

Any help will be greatly appriciated.
Title: Re: Is save game slot used?
Post by: Khris on Sat 16/04/2005 14:58:59
int handle = FileOpen ("agssave.xxx", FILE_READ);
if (handle == 0) Display("File doesn't exist.");
else {
Display("File exists.");
FileClose (handle);
}
Title: Re: Is save game slot used?
Post by: FrogMarch on Sat 16/04/2005 15:03:54
Thanks for the quick reply khrismuc, I think I can edit that to get what I want.

Cheers  ;D
Title: Re: Is save game slot used?
Post by: Ashen on Sat 16/04/2005 15:20:59
Little late, but you could also use:

string buffer;
if (GetSaveSlotDescription(SLOT,buffer) == 0) { // i.e. Slot doesn't exist
  // SetButtonPic, or whatever
}
else {// Slot exists
  // Whatever
}


Or (maybe more direct use, if you've selected 'Save Screenshots in save game'):

int sprite = LoadSaveSlotScreenshot(SLOT, 50, 50);
if (sprite > 0) { // i.e. if Slot existed
  SetButtonPic(GUI, BUTTON, 1, sprite);
}
else SetButtonPic (GUI, BUTTON, 1, BLANKPIC);