spacer graphic
spacer graphic
Montage of games AGS Logo
spacer graphic

 

spacer graphic
Menu
spacer graphic Home
About
News
Features
Download AGS
spacer graphic Games 
Games main page
Award Winners
Picks of the month
Short games
Medium length games
Full length games
In Production
Hints & Tips
Community
Forums
AGSers World Map
Member websites
Chat
Resources
Tutorials
FAQ
Knowledge Base
Downloads
Links
AGS-related links
* AGS Manual
  * Scripting
    * Game / Global functions

SetSaveGameDirectory

static bool Game.SetSaveGameDirectory(string directory)
Changes the directory where save game files are stored to the supplied directory. If the directory does not exist, AGS will attempt to create it.

You cannot use fully qualified directories with this command (eg. C:GamesCoolSaves), because the player might have installed your game to any folder, and they might not be running Windows.

Therefore, only two types of path are supported:
1. Relative paths (eg. "Saves"). This will create a "Saves" folder inside your game folder
2. The special tag $MYDOCS$ which allows you to create a folder for your save games inside the user's documents folder. On Vista, this is the "Saved Games" folder; on Windows XP and earlier, this is "My Documents". On Mac and Linux, currently this just points to the game folder.

Returns true if the save game directory has been changed successfully; false if not.

NOTE: It is recommended that you do not use this function. Instead, set the "Save games folder name" property in the General Settings of the editor, which allows the save games to be detected by Vista's Game Explorer, and avoids problems writing to the Program Files folder.

Example:

Game.SetSaveGameDirectory("$MYDOCS$/My Cool Game Saves");
will change the save game directory to "My Cool Game Saves" in My Documents, and create the folder if it does not exist (might be useful to do this in game_start).

See Also: ListBox.FillSaveGameList, RestoreGameDialog


User comments and notes
There are currently no user comments on this page.
The user comment facility is currently disabled.