Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Peegee on Fri 01/12/2023 08:28:50

Title: Save F5/F7
Post by: Peegee on Fri 01/12/2023 08:28:50
Hello, I would like to make a simplified backup.

There is by default the F5 key that leads to a GUI, but I want to avoid it going through there. I would just like it to save directly, on one location, with just a reminder on the game screen "Saved Game". And that it loads directly when we press F7.

Anyone know how to do that?
Title: Re: Save F5/F7
Post by: Peegee on Fri 01/12/2023 14:26:39
I found a simple solution:

SaveGameSlot(1, "save game");
RestoreGameSlot(1);

Only remains to find how to display a reminder on the screen "Game saved".
Title: Re: Save F5/F7
Post by: RootBound on Fri 01/12/2023 15:10:25
Just put
Display("Game saved!"); as the line right before SaveGameSlot (otherwise it will display after a save game is loaded as well).
Title: Re: Save F5/F7
Post by: Peegee on Fri 01/12/2023 16:01:26
"Display", yes, but it's a very ugly display... How to put only the text in transparent, and not necessarily in the middle?
Title: Re: Save F5/F7
Post by: RootBound on Fri 01/12/2023 16:59:30
DisplayAt allows you to put the text wherever you want:

https://adventuregamestudio.github.io/ags-manual/Globalfunctions_Message.html#displayat

You can also change the default text window by creating your own GUI and then in the General Settings list selecting "Text Windows use GUI"

https://adventuregamestudio.github.io/ags-manual/EditorGUI.html#customized-text-windows

Honestly, just browsing the manual's index and clicking on whatever looks useful has yielded a lot of insight for me since I started.  :)
Title: Re: Save F5/F7
Post by: Peegee on Sun 03/12/2023 10:36:50
Ok, thanks, I think I'll go for this solution.   PG
Title: Re: Save F5/F7
Post by: Khris on Mon 04/12/2023 09:25:18
There are various ways to display a message like that. A GUI is the most suitable, because you can easily fade it in and out, easily put text on it using a label and you can use an arbitrary sprite as background image.
Title: Re: Save F5/F7
Post by: eri0o on Mon 04/12/2023 12:56:11
There is also the event eEventRestoreGame which can be usually to conditionally automatically skip something - like the Game Saved message that you will show later.

In 3.6.1 there is also the event eEventGameSaved which can be used to be the thing that actually shows it - or not.

(And a bit early in development, but I started a module for messages that disappear (https://www.adventuregamestudio.co.uk/forums/modules-plugins-tools/module-toaster-0-1-0/) that may or may not be useful)