Author Topic: dungeons of dredmor - with tools!  (Read 9653 times)

Offline Cyborg

  • Master Member Mark III
  • *****
  • Posts: 1,957
dungeons of dredmor - with tools!
« on: July 18, 2011, 11:13:24 pm »
After suffering crashing to desktop and losing hours of playtime in these dungeons, I have come up with a solution:

Code: [Select]
# Dungeons of Dredmor defensive save program
# Author: cyborg
# License: same license as Perl, artistic
# Use at your own risk. No warranties or guarantees.
# Make the target of a Windows shortcut: "C:\Users\yourname\Documents\Gaslamp Games\save_and_dungeons.pl" "C:\Users\yourname\Documents\Gaslamp Games"
# You will need to use the in-game save option periodically for this to work. Double-click this shortcut before you begin the game.

use File::Copy;
use strict;

# signal handler to prevent screen disappearing too quickly on Windows after errors

$SIG{'__DIE__'} = sub {
    print "@_";
    sleep 10;
    exit;
};

sub directory_files
{
my $dungeon_directory = shift;
opendir(directory, $dungeon_directory) || die "Can't open directory $dungeon_directory: $!\n";
my @files = readdir(directory);
closedir(directory);
return \@files;
}

# Check to make sure the user knows what they're doing

unless($ARGV == 0) { die 'Need to pass your saved game directory. Try your users folder, for example:
C:\Users\Admin\Documents\Gaslamp Games
'; }
unless(chdir("$ARGV[0]")) { die "Cannot change to gaslamp documents folder.\n"; }
unless(-e "Dungeons of Dredmor") { die "Improper dungeons folder.\n"; }

# Readability
my $dungeon_directory = $ARGV[0];
my $k = 0;
my $count_directories = 10; # change this to change backup count

# Create directories
for($k = 0; $k < $count_directories; $k++)
{
unless(-d "backup_dungeon_$k")
{
mkdir("backup_dungeon_$k");
}
}

$k = 0;

while(1)
{
my $files = &directory_files("$ARGV[0]\\Dungeons of Dredmor\\");


foreach(@$files)
{
print "Backing up $ARGV[0]\\Dungeons of Dredmor\\$_ to backup_dungeon_$k\n";
copy("$ARGV[0]\\Dungeons of Dredmor\\$_", "backup_dungeon_$k\\");
}

sleep 100;
$k++;
$k = $k % $count_directories;
}



You will need to install Perl if you want to use it. It will give you the ability to create easy programs like this that will help you do all kinds of things from the command line. All you need to do is make a shortcut to this program and double-click it before you start playing. Just read the header for instructions.

I think it's really sad I have to write this crap. Getting angry over the crashes.  >:(


In other news, in regards to the defense versus offense topic, you have to balance damage in as well as damage out. There may be a way to get around all defensive playing, but you can still get surrounded in this game and not have the ability to retreat. Also, vampirism alone might not keep your health high enough during a battle sequence without a little extra help. Honestly, any procs that you can add is not a bad thing.
Kahuna strategy guide:
http://www.arcengames.com/forums/index.php/topic,13369.0.html

Suggestions, bugs? Don't be lazy, give back:
http://www.arcengames.com/mantisbt/

Planetcracker. Believe it.

The stigma of hunger. http://wayw.re/Vi12BK

Offline zespri

  • Hero Member Mark III
  • *****
  • Posts: 1,109
Re: dungeons of dredmor - with tools!
« Reply #1 on: July 18, 2011, 11:24:45 pm »
Lol, I did the same with powershell instead of perl. Unfortunately only an IT-inclined person is going to bother with installing perl/powershell and getting the script up and running.

Long time ago I saw a program, that you configure to watch a game save folder, whenever something changes there the program will save the whole folder in a configured place, making the subfolder name from the date/time when the save has happened. It also allowed easy copying of a back up back to the save folder for restore.

Something like this in a form of application rather than a script would help a lot, but who is going to bother writing it?

Offline Cyborg

  • Master Member Mark III
  • *****
  • Posts: 1,957
Re: dungeons of dredmor - with tools!
« Reply #2 on: July 19, 2011, 08:38:46 am »
Lol, I did the same with powershell instead of perl. Unfortunately only an IT-inclined person is going to bother with installing perl/powershell and getting the script up and running.

Long time ago I saw a program, that you configure to watch a game save folder, whenever something changes there the program will save the whole folder in a configured place, making the subfolder name from the date/time when the save has happened. It also allowed easy copying of a back up back to the save folder for restore.

Something like this in a form of application rather than a script would help a lot, but who is going to bother writing it?

Activestate has an automated installer. If people cannot be bothered to run the installer, I don't really care. I wrote it for myself; I just decided to share.

However, it should be known that you can bundle Perl scripts inside of executable files (and I have done so successfully for people), effectively making a miniature Perl with an automatic execution of a script to act like a binary. It's known as PAR(well, PAR-packer is really what you want).

Kahuna strategy guide:
http://www.arcengames.com/forums/index.php/topic,13369.0.html

Suggestions, bugs? Don't be lazy, give back:
http://www.arcengames.com/mantisbt/

Planetcracker. Believe it.

The stigma of hunger. http://wayw.re/Vi12BK

Offline Awod

  • Newbie Mark III
  • *
  • Posts: 48
Re: dungeons of dredmor - with tools!
« Reply #3 on: July 20, 2011, 11:10:53 pm »
Thanks. Very useful until they have crash bugs sorted out, Hell one day I found out that 'quitting' deletes your save. They've since added a bit more to pop-up actually telling you that but still.. loaded it up that day, suddenly had plans so I quit. Then next time to my dismay I saw no save file. :'(

Offline Cyborg

  • Master Member Mark III
  • *****
  • Posts: 1,957
Re: dungeons of dredmor - with tools!
« Reply #4 on: July 20, 2011, 11:13:22 pm »
Thanks. Very useful until they have crash bugs sorted out, Hell one day I found out that 'quitting' deletes your save. They've since added a bit more to pop-up actually telling you that but still.. loaded it up that day, suddenly had plans so I quit. Then next time to my dismay I saw no save file. :'(

You're welcome, glad it was useful.
Kahuna strategy guide:
http://www.arcengames.com/forums/index.php/topic,13369.0.html

Suggestions, bugs? Don't be lazy, give back:
http://www.arcengames.com/mantisbt/

Planetcracker. Believe it.

The stigma of hunger. http://wayw.re/Vi12BK