Computer crashed... and it took away my preferences.

me259259

Member
So the other day, I was using KoL mafia when my computer crashed. Once I had restarted everything, KoL had set some settings back to their defaults. I had to manually set my recovery options, choice adventure preferences, things like that. I reset these, which wasn't that big of a deal, and that was the end of that... or so I thought. I was in the middle of an ascension when this had happened. When I hit level 11, I discovered that mafia had forgotten my demon summoning names. Did mafia save these names somewhere in a text file, so all I need to do is summon each demon once in order for mafia to remember them? Or something like that? Or do I need to adventure and get the names all over again?
 

slyz

Developer
If Mafia has forgotten the names, then they aren't in the .txt file where they are kept anymore.

If you want to make a backup next time, all the setting are in \settings\<playername>_prefs.txt

The demon names are saved in the preferences demonName1 to demonName8.
 

Spiny

Member
Am i wrong in thinking, to prevent this from happening in the future, that one needs to enable the option under General => Save options to disk whenever they change. Also, it's a good idea to use your quest notes section or some other external notetaking method to store your demon names so that this sort of thing doesn't screw you over in the long run. A good way of retrieving the stored names is if you've been using mafia all along, you can use a shell session and the grep command to try to find the demon names in your past files. It can take a while, but if you have the right data, it can be done.
 

Grotfang

Developer
A good way of retrieving the stored names is if you've been using mafia all along, you can use a shell session and the grep command to try to find the demon names in your past files.

Definitely, definitely recommend this. If you run windows, cygwin is worth it purely for grep functionality alone. If not, then lucky you -- just use grep from the terminal.

Good advice, sir!
 

Fluxxdog

Active member
Am i wrong in thinking, to prevent this from happening in the future, that one needs to enable the option under General => Save options to disk whenever they change.
Yep, you're wrong. I've had it happen three times now since I started using mafia and always had that option enabled. Not exactly sure why it happens either. My best guess, it may be leaving the file open, mafia comes along sees it corrupted somehow and completely overwrites it with defaults.
 

me259259

Member
Oh yeah, the log files, there might be a couple demon names in there.

I'm new to cygwin, and I don't know much about the grep command. Is there a way to set it so it'll look for all lines with "demon" in it, for all files in a directory? Or do I have to do a separate search for each file in a directory?

Also for the record: I did have it set up to save changes to the disk before the crash.
 

Spiny

Member
To use grep to find lost demon names, I'd suggest:

First navigate to the session directory, then:

Code:
grep -B 1 "Demon name: " *.txt

That should search each session log and return the demon name along with the adventure that it is associated with. You can then deduce the demon number and re-teach mafia by setting the appropriate preferences.
 
Last edited:

Theraze

Active member
In Windows, you can go to the sessions folder in a command prompt and do:
findstr /i /c:"summon " *
which will show you all of the actual summonings you've done... or you can do
findstr /i /c:"demon " *
to look for the word 'demon' instead. The /c: means to take it as a phrase, and the space after the word means to only match if the word ends, though a different way to do that would be to do them (I'll do the demon example again) like this:
findstr /i /r "demon$" *
which will look only for cases where the word 'demon' is the end of the line... the /c:"demon " and /r "demon$" should, between them, give you all of the examples of where the word demon is used, but i'm guessing the ones you want would be the actual summonings for the most part. :)
 

me259259

Member
Sweet! I found the names of the demons that I regularly summon. Now all I have to do is adventure to find the ones I never use (for completion's sake). Thank you!

Edit: Just out of curiosity, is it possible to set up an auto-adventure condition to adventure until you get a demon name?

Edit 2: Nevermind. I see now that mafia will automatically stop when you get a demon adventure.
 
Last edited:

t4kato

New member
I just had the same problem twice, and am glad I found a topic detailing the same thing. My KoLmafia seemed to reset my preferences randomly, and it was only until I read this that I realized it only happens when my computer crashes.

Why does KoLmafia delete your settings when this happens? Shouldn't there be a fix? And I guess I'll start backing up now... haha.

EDIT: Also I'm thankful I keep a .txt file with notes on things like demon names already to mitigates issues like these.
 

fronobulax

Developer
Staff member
Mafia saves settings by writing them to disk. You probably want to check the General Preference "Save options to disk whenever they change" just in case. If your computer is crashing and mafia is losing its settings as a result, I hardly consider that mafia's problem. Fix your computer or operating system, please. Personally I consider it miraculous when a computer crashes and I don't have to repair the disk after and don't lose data.

All that said, there is logic in mafia to rebuild the files if mafia thinks they are not there or not usable. This logic has triggered in cases where people did not want it to and consequently settings were lost. However, the circumstances when this happens are known only vaguely and no one who has looked at the problem has figured out what to fix. The last time it happened to me it was the result of playing multiple characters without completely shutting down mafia between them.

But yes, the safest thing to do is back up the files somewhere else, just in case. Copying demon names into the Quest Log (in KoL) is also something many people do since losing the demon names seems to be the biggest problem when the file gets recreated.
 

Theraze

Active member
Alternatively if you already had the "Save options to disk whenever they change" selected, that could be causing the corruption... since it increases how often it updates the settings files, it increases the chance that at any given point, it might end up with a corrupted file. Life is fun all around, eh?
 
It seems to me that if KoLmafia settings are lost multiple times due to computer "crashes," then the most important thing is to figure out what is causing the crashes, and fix that. I don't mean that recovering the settings, or the loss of them, is unimportant. I am not implying or insinuating anything else. It's just that no one had mentioned this, and I thought someone ought to. Why figure out what's causing the problems?
1. Certainly it's affecting other things. They might recover more gracefully or more completely, but what if they don't? And what if they're part of your operating system, or something even more important than KoL (hard to imagine)?
2. Whatever's causing the crashes might be doing other things to you, too. And you might not know it. Yet.
 

Theraze

Active member
The problem is, once the computer crashes (and computer crashes is something that is outside of the realms of things we can actually predict or deal with fixing), the settings are gone... We can't exactly have them look through their old settings and tell us whether or not they'd tagged specific flags. :)

Figuring out why it's crashing? That's something for a forum on computers and why they crash. Not a forum board on KoLmafia bugs. :D
 

me259259

Member
It seems to me that if KoLmafia settings are lost multiple times due to computer "crashes," then the most important thing is to figure out what is causing the crashes, and fix that.

Holy Crap! Stop the computer from crashing! Why didn't I think of that? :p

The computer crash was caused by something unrelated to KoLmafia... it's just my misfortune that mafia was running at the same time. To be safe, I don't run the thing that caused the crash when mafia is up... but it could happen again with another program. I back up my settings now to prevent myself from getting into this situation again, but it'd be nice if there was a little safety net for newer users who don't think of backing up their stuff.
 
Last edited:
Top