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

This Month's Specials

ATF: Armored Task Force- Save $8.00
War Plan Pacific- Save $8.00

   







Go Back   .com.unity Forums > Illwinter Game Design > Dominions 3: The Awakening

Reply
 
Thread Tools Display Modes
  #1  
Old June 5th, 2008, 01:25 AM

MaxWilson MaxWilson is offline
Major General
 
Join Date: Mar 2007
Location: Seattle
Posts: 2,497
Thanks: 165
Thanked 105 Times in 73 Posts
MaxWilson is on a distinguished road
Default Backup tool

I realized that one reason my turns go so slow even in SP is because, having spent hours or days developing a strong gaming position, I don't want to throw it away with stupid errors like forgetting to re-hire Obscuro when I badly need an air mage. It makes me paranoid and I check everything thrice. (It's sort of the same reason that makes Axis and Allies play so slowly if you're playing against someone who rigidly enforces the phases and won't let you attack if you make a noncombat move.) So, I decided to address this by writing a quick little Python script that backs up my files each turn.

Remember that the distinction between a script and a program is that a program is opaque and a script is transparent and meant to be fiddled with by the end user--i.e. my error handling in this script is not robust. Oh well. You may still find it useful. Save it to your dom3 root directory and run dom3 with the --preexec switch and the name of the game you'll be playing. On Windows this would be

dom3 --preexec "backup.py <gamename>"

Yeah, I know, having to type in the name of the directory to back up is onerous, etc. Maybe I'll fix it later but right now this is what I'm using.

-Max

edit: That's funny. The attachment is gone, and there's no option to create a new one. I'll paste in the text here directly, although now maybe I'll use Ich's version instead. My script:

import sys
import os
if len(sys.argv) != 2:
print "Usage: backup <gamename>"
exit()

def execute(cmd):
print cmd
os.system(cmd)

gamedir = 'savedgames\%s' % sys.argv[1]
print 'Backing up', gamedir
execute('cd %s' % gamedir)
execute('mkdir %s\\backup' % gamedir) # Could already exist, but oh well, ignore the error
execute('erase %s\\backup\\* /Q' % gamedir)
execute('copy %s\\* %s\\backup /Y' % (gamedir, gamedir))
__________________
Bauchelain - "Qwik Ben iz uzin wallhax! HAX!"
Quick Ben - "lol pwned"

["Memories of Ice", by Steven Erikson. Retranslated into l33t.]
Reply With Quote
  #2  
Old June 5th, 2008, 08:34 AM

SsSam SsSam is offline
Corporal
 
Join Date: Mar 2008
Posts: 81
Thanks: 5
Thanked 4 Times in 4 Posts
SsSam is on a distinguished road
Default Re: Backup tool

Silly me. Where can I dl the script?
Reply With Quote
  #3  
Old June 5th, 2008, 10:42 AM
lch's Avatar

lch lch is offline
General
 
Join Date: Feb 2007
Location: R'lyeh
Posts: 3,861
Thanks: 144
Thanked 403 Times in 176 Posts
lch is on a distinguished road
Default Re: Backup tool

Quoting myself from the Tools & Tutorials thread:

Lollipop wrote a solution to automatically backup turns in Python.
__________________
Come to the Dom3 Wiki and help us to build the biggest Dominions-centered knowledge base on the net.
Visit my personal user page there, too!
Pretender file password recovery
Emergency comic relief
Reply With Quote
  #4  
Old June 5th, 2008, 11:25 AM
lch's Avatar

lch lch is offline
General
 
Join Date: Feb 2007
Location: R'lyeh
Posts: 3,861
Thanks: 144
Thanked 403 Times in 176 Posts
lch is on a distinguished road
Default Re: Backup tool

Quote:
MaxWilson said:
edit: That's funny. The attachment is gone, and there's no option to create a new one.
There is. When you edit your post, there's a checkbox titled "I want to preview my post and/or attach a file".

But your Python script is more like a wrapper for a shell script, anyway. Not really portable between system, I think.
__________________
Come to the Dom3 Wiki and help us to build the biggest Dominions-centered knowledge base on the net.
Visit my personal user page there, too!
Pretender file password recovery
Emergency comic relief
Reply With Quote
  #5  
Old June 5th, 2008, 12:23 PM

MaxWilson MaxWilson is offline
Major General
 
Join Date: Mar 2007
Location: Seattle
Posts: 2,497
Thanks: 165
Thanked 105 Times in 73 Posts
MaxWilson is on a distinguished road
Default Re: Backup tool

Absolutely. Lolly's is much better.

P.S. You're right, it gives you the option when you hit "Continue." I *did* tell it to attach the attachment. I even attached it again when I edited the post to add the script in the message body, but it's still not there. Strange.
__________________
Bauchelain - "Qwik Ben iz uzin wallhax! HAX!"
Quick Ben - "lol pwned"

["Memories of Ice", by Steven Erikson. Retranslated into l33t.]
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 07:31 PM.


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