Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Slasher on Wed 05/03/2014 10:05:10

Title: Max number of save slots help wanted..
Post by: Slasher on Wed 05/03/2014 10:05:10
Hi,

I am implementing a maximum save game slots. If the player tries to save a new game slot when the maximum is reached a message appears telling them they must delete an already game slot before they can save a new game slot.

The maximum number of slots is 8. It seems to work ok untill you start deleting all slots and the slots scroll down showing unseen saves.

The border and arrows are set to false.

What would be a better way than this?

Code (ags) Select


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);


if(i>=7)
{
DeleteSaveSlot(7);
DeleteSaveSlot(8);
Display("You must delete a saved game first before you can make a new save slot.");
}
  else
{

aButton_click4.Play();
gSaveGame.TweenSize(0.5, 800, 10, eEaseInTween, eBlockTween);
mouse.Mode=old_mode;
close_save_game_dialog();
}
}


Could someone assist please?

Thanks


EDIT: Gone a different route


Title: Re: Max number of save slots help wanted..
Post by: monkey0506 on Wed 05/03/2014 17:07:49
I realize that you say you've "gone a different route", but why on earth did you decide that calling SaveGameSlot and then doing bound-checking was a good idea? Nevermind the fact that SaveGameSlot is a delayed function, but then you're attempting to delete the newly created save slot before it's been created and thus your entire issue of phantom saves seems pretty much in line with what you've asked it to do. :sealed:
Title: Re: Max number of save slots help wanted..
Post by: Snarky on Wed 05/03/2014 18:10:40
Hopefully the "different route" involves not limiting the player to 8 saves.

A one- or two-save limit I can understand as a game mechanic decision, but when you're giving the player a handful of saves, that implies that creating a bunch of save games during play is something the player might legitimately want to do and doesn't detract from the gameplay. But then you're arbitrarily limiting it to 8... why? Just to cause players frustration at the point where they run out of slots?
Title: Re: Max number of save slots help wanted..
Post by: Slasher on Wed 05/03/2014 19:06:07
Hi,

Monkey:

Quotebut why on earth did you decide that calling SaveGameSlot and then doing bound-checking was a good idea?
I did eventually realise this and knew, as I looked at it a bit longer, it would not work the way I wanted ;(

Snarky:

QuoteJust to cause players frustration at the point where they run out of slots?
The limited number of Saves no longer applies ;)

It was an idea I had, and ideas don't always work or are appropriate..

cheers