Jump to content
LaunchBox Community Forums

AHK script to save a game folder after a game quits. Is it possible and if so how?


Kinglifer
 Share

Recommended Posts

I am going back to my kid days by installing Transformers War / Fight for Cybertron (Two awesome PC games made by Activision). The main issue is both games put the save games in the exact same spot with the exact same name.

"C:\Users\GamerPC\Documents\My Games\Transformers\TransGame\"

Even if you do nothing the save game becomes corrupt if you load the other game out of the two. You then loose the saves from the previous game. So the file must be moved or renamed to keep it intact.

I was trying to use Display Fusion Pro (It has scripts to copy files etc.) but the Load before and Load after section in Additional Apps is not working. I did a test run to show a pop up while the script is running so I know it does it but somehow the game just boots back to the original startup (as if there was never a save game). If I do it manually it works obviously. (Copy the file then start the game).

Is there a script that can do this for me and how would I set it up? 

 

game path ..\TRANSFORMERS.War.for.Cybertron\TRANSFORMERS - War for Cybertron\Binaries\TWFC.exe

my back up save path is ..\TRANSFORMERS.War.for.Cybertron\TRANSFORMERS - War for Cybertron\

 

and for the other game... 

game path ..\Transformers.Fall.of.Cybertron.Incl.ALL.DLCs\Transformers - Fall of Cybertron\Binaries\TFOC.exe

back up save path is ..\Transformers.Fall.of.Cybertron.Incl.ALL.DLCs\Transformers - Fall of Cybertron\Binaries\

 

both games save the game progress in "C:\Users\GamerPC\Documents\My Games\Transformers\TransGame\"

exact same name so that is where the conflict happens.

 

Even a renaming process could work instead of moving the folder like "WOCsavegame" and "FOCsavegame" and returns that folder back to "TransGame" before whatever game starts.

 

HELP!

 

Edited by Kinglifer
typo
Link to comment
Share on other sites

well that is some of the worst file management I've ever heard of from so called professionals 🤦‍♂️. you can use a script to move/copy the file(s) around as needed to keep things sorted for yourself.

Lets consider the structure of what you need done here. I'll call them game A and game B for the ex. When game A boots it first needs to look for a game A specific save file. It will take this game A save file and copy it to the normal save file location with the normal file name. Now the game uses this game A save file that was placed in the normal location and you play the game. After exiting the game the save file that was just created in the normal save file location must be copied to overwrite the previous game A specific save file. Rinse and repeat each time this game is launched. Then change things accordingly for game B and you're done

I assumed for the example here that the save file is called savefile.dat and recommend keeping these files in the normal save location. change out the save file and game exe as needed. You will need a separate script for each game. Please note this script needs to run before the main application since you need to make sure the game specific save file is copied to the normal save file location prior to the game booting. This script also requires you have already created the game specific save files manually prior to first using it.

in the end this means you will have three save files in the same folder: normal save file, game A specific save file, and game B specific save file.  they all get copied and overwritten as needed per the scripts. I have that sleep bit in there because who knows when the game is actually writing the save file, if anything waits until the game exits it needs a brief moment to finish making the write. so this may not be needed, but it's there out of an abundance of caution

 

;will copy the game specific save file to normal save file location with normal/shared file name
;1 value = the file will be overwritten if it already exists
FileCopy, C:\Users\GamerPC\Documents\My Games\Transformers\TransGame\TWFCsavefile.dat, C:\Users\GamerPC\Documents\My Games\Transformers\TransGame\savefile.dat, 1

;Waits for game to exist - insert game's exe file name
WinWait, TWFC.exe

;Waits for game to exit - insert game's exe file name
WinWaitClose, TWFC.exe

;Pauses script to ensure enough time has passed for the save file to be written prior to copying it
Sleep, 5000

;will take the game save that was made at exit of current session and overwrite the specific game A or game B save file
;1 value = the file will be overwritten if it already exists
FileCopy, C:\Users\GamerPC\Documents\My Games\Transformers\TransGame\savefile.dat, C:\Users\GamerPC\Documents\My Games\Transformers\TransGame\TWFCsavefile.dat, 1

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...