I remember reading few Posts asking about save feature, so I decided to share my script which auto-saves your game after every turn, and it also saves all your games once a day.
There're 2 files required that should go into your DomII installation directory:
save_script.awk:
code:
BEGIN {
timestamp_file = "Last-total-save-timestamp.txt";
t = systime();
stamp = strftime("%Y%m%d-%H%M%S",t);
stamp2 = strftime("%Y-%m-%d",t);
saveAll = 1;
if ((getline Last_stamp < timestamp_file) > 0)
{
if (stamp2 == Last_stamp)
saveAll = 0;
}
close(timestamp_file);
if (saveAll)
{
cmd = sprintf("zip -r save-all-%s * -i@save.lst",stamp);
print stamp2 > timestamp_file;
}
else
cmd = sprintf("zip -r -t %s save-%s * -i@save.lst",Last_stamp,stamp);
system(cmd);
}
save.lst:
code:
*/ftherlnd
*/*.2h
*/*.trn
Also, add --postexec "gawk -f save_script.awk" to your starting command. For example:
code:
E:\gm\dominions2\dom2.exe --postexec "gawk -f save_script.awk"
This will create timestamped zip file for every turn, and also once a day you'll get timestamped "save-all" file with all your games.
To restore the saved game just unzip appropriate save file.
The only current problem is that after the hosting Dom II window is going into the background and one has to alt-tab back into it. Not sure how to resolve it yet (even worse I'm not sure why it happens).
/Alex.
P.S. You need to have zip and gawk on your machine and path should include directories where they are.