Feature - Implemented Make autoSatisfyWith a user preference

Fluxxdog

Active member
Almost discovered the hard way that autoSatisfyWithCloset is a global preference. This is... surprising to say the least, since each character will want to handle their characters' inventories differently. The change to defaults.txt is easy enough, but it would have the preferences set in both GLOBAL_prefs and the user individual preferences. Any way to work with that?

What does surprise me is that the GLOBAL_prefs would save anything that wasn't an actual GLOBAL pref. But then again, catches probably aren't built in to keep the GLOBAL preferences clean.
 

Veracity

Developer
Staff member
I was just thinking about this myself.

- I have one character with a broken hippy stone who wants autoSatisfyWithCloset.
- My test multis do not want that.
- I have one character with a Winter Garden who wants to harvest a frost flower during breakfast.
- I have another character with a Peppermint Patch who wants to harvest peppermint sprouts.

Both the autoSatisfy and the Breakfast preferences are GLOBAL, not per-character.

I don't understand what you mean by "What does surprise me is that the GLOBAL_prefs would save anything that wasn't an actual GLOBAL pref". GLOBAL_prefs saves any preference that came from that file. defaults.txt says where a preference goes and is used to initialize a preference for the first time. But once it puts a preference into GLOBAL, that's where it stays henceforth.

The issue, obviously, is how to migrate a preference from GLOBAL to a user file. Perhaps something like this:

when we load a user preference file, in Preferences.ensureUserDefaults

Code:
for all "user" default preferences
    if it is not in the user file
        if it is in the GLOBAL file
            copy it from the GLOBAL file to the user file
        else
            copy it from the default value
This means it will never get removed from the GLOBAL file, but, who cares.
 

fronobulax

Developer
Staff member
I seem to recall this discussion before and "how to migrate" was the sticking point. I recall the effort getting sidetracked by things like "Do we really need Global Preferences?", "How to we detect and remove OBE preferences so we don't get users editing an OBE preference in a file Bug Reporting that the preference does not work?" and "Should we retrofit the underscore convention to preferences that should use it but predate the convention?".

Scope creep seems to have derailed the earlier effort so this is A Good Idea if we stay focused. As the anal type who does care about OBE entries in files I can certainly script something to identify the OBE values so me caring is not relavent :)
 

Veracity

Developer
Staff member
I seem to recall this discussion before and "how to migrate" was the sticking point.
What I proposed actually works well.

I recall the effort getting sidetracked by things like "Do we really need Global Preferences?"
Yes we do, if only for things that go on the login window - like the list of saved user names. I also believe that things like which windows go into tabs and saved window sizes and such should be global, since they are things that I want to be the same for all of my characters. I do recall that some people wanted different window positions for each character. Those people are wrong. :)

"How to we detect and remove OBE preferences so we don't get users editing an OBE preference in a file Bug Reporting that the preference does not work?"
Answer: we do not remove them. The obsolete preference clutters up the GLOBAL file, causing frono distress, but otherwise causing no harm. If someone changes the preference in an editor rather than through KoLmafia's GUI, it is their fault if they screw up, and if they write such a bug report, we immediately mark it Not a Bug.

"Should we retrofit the underscore convention to preferences that should use it but predate the convention?"
A different issue which is not addressed by this.

Scope creep seems to have derailed the earlier effort so this is A Good Idea if we stay focused.
And it is done in Revision 15067 for the autosatisfy and breakfast settings. In particular, the following moved from GLOBAL to user:

Code:
user	autoPlantHardcore	false
user	autoPlantSoftcore	false
user	autoSatisfyWithCloset	false
user	autoSatisfyWithCoinmasters	false
user	autoSatisfyWithMall	false
user	autoSatisfyWithNPCs	false
user	autoSatisfyWithStash	false
user	autoSatisfyWithStorage	true
user	breakfastHardcore	Advanced Saucecrafting,Pastamastery,Advanced Cocktailcrafting
user	breakfastSoftcore	Advanced Saucecrafting,Pastamastery,Advanced Cocktailcrafting
user	checkJackassHardcore	true
user	checkJackassSoftcore	true
user	grabCloversHardcore	false
user	grabCloversSoftcore	true
user	grimoireSkillsHardcore	none
user	grimoireSkillsSoftcore	Summon Hilarious Objects
user	harvestGardenHardcore	none
user	harvestGardenSoftcore	none
user	libramSkillsHardcore	none
user	libramSkillsSoftcore	none
user	loginRecoveryHardcore	false
user	loginRecoverySoftcore	true
user	pathedSummonsHardcore	true
user	pathedSummonsSoftcore	false
user	readManualHardcore	true
user	readManualSoftcore	true
user	tomeSkillsHardcore	Summon Snowcone
user	tomeSkillsSoftcore	all
user	useCrimboToysHardcore	false
user	useCrimboToysSoftcore	true
user	visitLoungeHardcore	true
user	visitLoungeSoftcore	true
user	visitRumpusHardcore	true
user	visitRumpusSoftcore	true
 

Razorsoup

Member
...I also believe that things like which windows go into tabs and saved window sizes and such should be global, since they are things that I want to be the same for all of my characters. I do recall that some people wanted different window positions for each character. Those people are wrong. :)...

What would happen if one of those people manually moved the relevant preferences to the user pref files? Would mafia find and read the prefs from there or would it recreate them in the global prefs file?
 

Veracity

Developer
Staff member
What would happen if one of those people manually moved the relevant preferences to the user pref files? Would mafia find and read the prefs from there or would it recreate them in the global prefs file?
If by "relevant preferences", you are referring to one of the ones I did NOT move from GLOBAL, KoLmafia will never look for those in the "user" file, and if it is not present in the GLOBAL, file, it will be recreated from defaults.txt.
 

Theraze

Active member
One question on this... before, if you wanted to change your breakfast settings, you could do it before logging in at the login GUI, so that anything that shouldn't happen, wouldn't. Does this change still allow that, or is the official way to fix a problematic breakfast setting now to manually edit the relevant character's settings text file?
 

Veracity

Developer
Staff member
The official way to fix "problematic breakfast settings" is to uncheck the "breakfast" checkbox on the Login frame, log in, change the settings, and run "breakfast" via the gCLI.

That worked before, too.
 
Top