The idea behind the batch file is that whenever you reach a point where you would like to preserve your existing character, you can save, exit the game, and the batch file will backup the Save directory to a new directory that the game will not modify. If you later get killed, then the batch file can copy this backup directory over to the Save directory, and you can resume from that point.
Hardcore crawlers refer to this practice as "save scumming," and prudes disapprove, which is weird, considering it's just a game. I find the angry reactions aroused by the idea of so-called "cheating" to be peculiar and amusing. All around the Internet and even in comments on my own blog, one can find Dungeon Crawlers scolding other players about this. It is like some kind of religious injunction. I pay it as much mind as I do other religious injunctions.
Here's my handy-dandy script (batch) file for cheating at Dungeon Crawl. At a minimum, it is compatible with either Linux or Windows XP, both of which I use, and I have been told it also works on Windows 7 due to logic I have placed in the batch that adapts to Windows 7's pathnames.
All of my computers use either Windows 7 or a version of Linux. I used to play Crawl on Windows XP, back when I had an XP system. I know for sure that the batch file will run perfectly on XP. Now I have adopted Linux as my primary operating system, and Windows 7 is used as an answering machine. I use Linux to do everything else, including play Dungeon Crawl. So I don't really know how the batch runs on Windows 7, although users have written in to say it works okay.
I've tried to distill as much intelligence as I can into the batch. I do not use the Installer, but the batch will adjust its pathnames automatically upon successful detection of an Installer-created Dungeon Crawl Stone Soup installation. If you encounter any problems, it will more than likely have to do with the pathnames used by your version of Windows or else unsupported batch commands. There is help widely available on the Internet for programming in batch, but I will attempt to help anyone that has a problem that is likely to be shared among many users. I enjoy programming in batch language, because it does not require a cumbersome and slow compiler, but concede that the language is quite limited both in capability and debugging options. I have my own ways of debugging that work for me although they are quite challenging, but the challenge is part of the fun for me. Even with good technique, often it takes guesswork and plenty of knowledge to deduce what is going on. So if you get into batch programming, first of all don't get into batch programming--but if you do, then prepare to search Google on a regular basis for tips, tricks and syntax, because Microsoft Help is not always quite as helpful as it could be.
I have been using some variation of this batch file for years to play Dungeon Crawl. Happy Crawling!
Installation (new method, faster and easier): Click here to download the file regen.zip. The archive contains both a batch file for Windows users and a shell script for Linux users in one big happy family. Mac users are left in the lurch! I don't know anything about Macs, sorry.
The script for Linux is called regen.sh. Linux users should unzip the contents into a directory of their choice. Of course, you may delete the Windows file, regen.bat, which you will not use. The instructions for Linux are more involved, because Linux is more concerned with security. I place my script in /home/games/regen_for_linux/regen.sh, but you can store it wherever you like. Open a terminal and modify the security of the script using the syntax, "chmod +x regen.sh". Next, set up a launcher to run the included script file from your desktop. When creating the shortcut, click the "Application" tab, click the "Advanced Options" button, and check the box for "Run in terminal." Run the game at least once by itself before using regen.sh, so that the game can create all its data directories. Additional instructions will be found in the script itself. The file regen.png may serve as a launcher icon.
Windows Users should unzip the contents into c:\games. They may delete the Linux file, regen.sh, as they will not use it. Create a shortcut to "regen.bat" on your Windows desktop and use that shortcut to play the game. You may configure the shortcut to use the included icon, regen.ico. Windows XP (at least) will accept files of type .ico as desktop icons.
- This batch file, and any page on Igor's blog, is not static but is subject to change--improvement--at any time. You may link to this page on other web sites and be assured of referencing the very latest version of regen.bat for Windows and regen.sh for Linux at all times now and in the future.
- To use this strategy effectively, you should save your game and quit at a point where you may wish to recover your character later upon any unexpected demise.
- I play the latest version of Crawl, either the trunk (beta) or the last stable release. You have a better chance of the script/batch file working correctly if this is also your scenario. Through the years, the Stone Soup developers have altered the path and file names of the saves directory. However, the script/batch is designed in such a way that modifications are elementary, consisting of one or two edits of constants at the most.
- On my Linux computer, I have created a new directory in Home called games and placed the linux shell script (regen.sh) and its icon in there. I believe it is important for the name of the directory to have no spaces. One must either chmod the two relevant crawl directories in order to permit file copies and deletions or else grant root permissions for this script, because otherwise Linux denies permission to the many file copies. I'm not well-versed on this sort of thing. I used to give my launcher root permissions via "sudo ~/regen.sh", but my current method is to chmod the two crawl directories, because that eliminates the need to enter the root password every time one plays.
- On my Windows XP computer, regen.bat is stored in c:\games. Crawl and its files are installed to c:\games\crawl. For Windows, these are also the default assumptions made by regen.bat. If your setup is the same, then you should encounter no difficulty. Otherwise, the batch will attempt to self-adjust its assumptions--it has some primitive intelligence, not much--but if that doesn't work, regen.bat will tell you so, and at that point you will have to edit the variables relating to pathnames. By design, few pathnames are hardcoded, meaning the batch should be relatively easy to modify.
- Linux has a built-in capability of accepting a single keypress for input and overall a far more robust scripting language than Windows. Batch programming in Windows, however, remains in the Stone Age. It is a wonder I ever programmed the Windows batch at all. For Windows users, improved functionality is possible with the old Choose32.exe utility, which permits the user to press a single key for input rather than a key followed by the Enter key. Choose32.exe should be placed in the dir containing the crawl subdirectory. On my system, that is c:\games. You can substitute some other keyboard input utility if you prefer, modifying the batch accordingly, or you can skip this option altogether. I have coded the batch so that it will continue working in the old way for users that are leery about downloading and installing an .exe file.
- 11/28/2013 Update:
Change to regen.sh: sleep a second after wmctrl, because the computer takes a random number of milliseconds to adjust the display. Clarify a display message.
- 11/27/2013 Update:
Change to regen.sh: fix a few bugs. Maximize window if wmctrl is available.
- 10/18/2013 Update:
Change to regen.sh: corrections to the menu display and new optional mods to automate setting tiles to full screen and other preferences of mine. The script now reflects a change in version 13 of the location of the macro file.
- 9/16/2013 Update:
Change to regen.sh: Recognize the existence of Sprint and Zotdef saves and tidy up the code a little bit.
- 1/31/2013 Update:
Change to regen.sh: Handle the case where Crawl has not yet been installed or executed.
- 1/29/2013 Update:
Just a few minor refinements to text messages in regen.sh and the addition of a loop to handle permission-granting, in case the user types an incorrect password.
- 1/21/2013 Update:
Once again, Linux refinements only. regen.sh was not handling chmod quite right; chmod -R is more to the point as it liberalizes permissions for all the files and folders within the two relevant Crawl directories. I made a few other changes of no special importance. It is my intention that regen.sh should handle DCSS upgrades seamlessly, asking for permission to chmod when necessary.
- 1/19/2013 Update:
Further refinements to the Linux script, which is now coming into its own, looking better and acting smarter. Rather than have sudo ask me for my password everytime I play (ach!), I prefer to chmod 777 the permissions of two crawl directories, which is Linuxese for "allowing read/write access to everyone".
- 1/16/2013 Update:
Added a few minor refinements to the Linux script that occurred to me this evening, including a suggestion for avoiding the annoyance of sudo.
- 1/16/2013 Update:
Many improvements made and features added to the Linux script. It is somewhat more intelligent now and will attempt to detect and report certain problems before they occur.
- 1/14/2013 Update:
I have successfully ported regen.bat to Linux! Many improvements made between Jan. 13 & Jan.14th to the Linux script, which does however require root permission in order to shift files around. Through trial and error, I have found that sudo is the thing, not kdesudo, which is for graphical programs. Kdesudo will cause errors. There is no way I know of getting around the permission requirement other than disabling the security altogether on one's system. I'm not quite confident enough to second-guess the Linux developers on that score. I'd rather just play along according to their rules.
- 11/13/2012 Update:
Minor edits for compatibility with Crawl 12 beta.
- 10/17/2012 Update:
Colorized the text, added for the first time a free public domain icon, reorganized the main menu, and fixed several bugs throughout the mods menu.
Fixed a little bug that had broken the 'edit batch file' option. Oopsy-daisy. Added a little colorizing trick that had occurred to me.
Improved the efficiency of the Install-New-Crawl option. Fixed the broken macro mod. Added polychromatic effect to mod menu.
Fixed a little issue with install-new-crawl. So many variables now, and of course batch language won't help me in keeping track of them.
- 10/08/2012 Update:
Add option to install new version of Crawl using 7-Zip or WinRar. This will install the game into a directory that is the default for regen.bat and thus ensure 100% compatibility. Several bug fixes to the Mods menu. Added 'command enhancement' mod.
- 09/30/2012 Update:
Just a few minor tweaks to improve efficiency. Improved start-up performance by skipping an unnecessary FIND. Eliminated a few redundancies through the use of subroutines. Reworded some comment statements. Everything working well on Windows XP with the latest beta version .11.