![]() |
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)) |
Re: Backup tool
Silly me. Where can I dl the script?
|
Re: Backup tool
Quoting myself from the Tools & Tutorials thread:
Lollipop wrote a solution to automatically backup turns in Python. |
Re: Backup tool
Quote:
But your Python script is more like a wrapper for a shell script, anyway. Not really portable between system, I think. |
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. |
All times are GMT -4. The time now is 05:57 AM. |
Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©1999 - 2025, Shrapnel Games, Inc. - All Rights Reserved.