.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

Reply
 
Thread Tools Display Modes
  #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
  #2  
Old January 15th, 2004, 09:44 PM
Gandalf Parker's Avatar

Gandalf Parker Gandalf Parker is offline
Shrapnel Fanatic
 
Join Date: Oct 2003
Location: Vacaville, CA, USA
Posts: 13,736
Thanks: 341
Thanked 479 Times in 326 Posts
Gandalf Parker is on a distinguished road
Default Re: YAAS (Yet Another Autosave Script)

Nice script. Good AWK code. Thanks.

-- Have you ever noticed that the Klingons are all speaking unix?
"Grep ls awk chmod."
"Mknod ksh tar imap."
"Wall fsck yacc!" (that Last is obviously a curse of some sort)

[ January 15, 2004, 20:43: Message edited by: Gandalf Parker ]
__________________
-- DISCLAIMER:
This game is NOT suitable for students, interns, apprentices, or anyone else who is expected to pass tests on a regular basis. Do not think about strategies while operating heavy machinery. Before beginning this game make arrangements for someone to check on you daily. If you find that your game has continued for more than 36 hours straight then you should consult a physician immediately (Do NOT show him the game!)
Reply With Quote
Reply

Bookmarks


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 05:04 AM.


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