.com.unity Forums
  The Official e-Store of Shrapnel Games

This Month's Specials

BCT Commander- Save $7.00
winSPWW2- Save $5.00

   







Go Back   .com.unity Forums > Illwinter Game Design > Dominions 2: The Ascension Wars

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old January 15th, 2004, 04:58 AM

alexti alexti is offline
First Lieutenant
 
Join Date: Dec 2003
Location: Calgary, Canada
Posts: 762
Thanks: 0
Thanked 0 Times in 0 Posts
alexti is on a distinguished road
Default YAAS (Yet Another Autosave Script)

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.
Reply With Quote
 

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 12:23 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©1999 - 2025, Shrapnel Games, Inc. - All Rights Reserved.