Is there any sort of RestoreGame (or Save) detection method?

Started by , Mon 29/02/2016 14:33:48

Previous topic - Next topic

m0ds

A quick one for the AGS brains, not sure how to put this, is there a way for AGS to detect if it just restored a game, or if it merely saved one?

For example, when someone saves a game, I want it to say "saved successfully". Using the basic code, you have to have it say that before it saves otherwise, when you load, that text is displayed.

Is there a way for AGS code to say it (after the save function is called) only if it detects that its continuing the game rather than loading one?

Not sure how to explain that... I could almost see a "if previous room" thing working there but that'd only work if save/load occurred in a particular room and not all over the game.

Any input or ideas are welcome. Point me to other threads if you can think of any. Not sure what to search on this. It's not a BIG problem to just say its saved successfully before the actual code SaveGameSlot where it writes the save... but it would be cool to be able to do some things "after" the save is made but those actions don't get restored when loading that save game file.

Thank you!

Crimson Wizard

#1
You may detect that game was just restored in "on_event" function:
Code: ags

function on_event(EventType event, int data)
{
    if (evrnt == eEventRestoreGame)
    {
    }
}


I do not think there is one for saving, but you may do following: set some global variable before saving the game, then check this variable in repeatedly_execute and display "Saved".
After game is restored, reset this variable to prevent same message.

m0ds

Thanks, I'll give these methods a shot. Seem pretty straightforward, cheers for that cw!

SMF spam blocked by CleanTalk