Feature - Implemented Customizable options in the Maximizer drop-down

fronobulax

Developer
Staff member
Not sure what you are referring to since I have not looked at the comments. The existing feature keeps a list of a user specified length that contains maximizer expressions sorted with the most recently used at the top. If the list is empty then it will be initially populated by whatever the KoLmafia defaults are. I recall thinking at the time that I wanted to add a button that would blow away the list and replace it with the mafia default list but I never did so because (if my memory is correct) the super class was building buttons and I saw no easy way to override that. (I probably should revisit that since I have been forced to confront my aversion to Swing code so may have a better understanding).

Anyway, if I wrote needs work then I was probably thinking of possible enhancements: Button to replace with defaults; option to never delete a mafia default from the list, just have it float to the bottom; Help that displayed the defaults; and user defined set of defaults to be used for all replacement operations. Given that those are features no one has asked for perhaps the comment "needs work" doesn't really mean it is unfinished.
 

roippi

Developer
I suspect that many users, myself included, will find themselves turned off of the maximizer's MRUlist since using it will increasingly overwrite the mafia defaults. I consider myself a fairly advanced user and even then I occasionally take inspiration from the built-ins.

I envision a reserved space at the top of the JComboBox dropdown that populates with MRUList entries, perhaps a JSeparator to provide some nice visual separation, then the built-ins. There's another thread around these parts that briefly discussed some of these points, though it kind of devolved into a flamefest. As for a reset-to-default button: I don't like buttons when they are not necessary, it's not good UI design.

I'll volunteer to look at it if you don't want to deal with Swing. I can't blame you for that, certainly.
 

fronobulax

Developer
Staff member
This is the discussion that never occurred which is why there is the sense of unfinished. I do a lot of automation. I keep the MRUList enabled because a) it assists in tracking down "interesting" behavior with BCCAscend and other scripts that make heavy use of the Mazimizer; b) (related) it makes it easy to tweak and experiment with settings; and c) I have most of the maximizer commands I use memorized.

So I am content with the status quo. That said, if I wanted to make it more useful I would consider the following:

1) Make sure there is a Help button and the help text lists all of the default maximizer commands.
2) As suggested, have a dropdown with two parts. The top part contains the five MRU commands in order and the bottom part contains a fixed list of the KoLmafia defaults.
3) The five MRU are persistent, per character, across sessions, regardless of whether a MRU entry was typed or just a default used as is.
4) The feature will be a core feature and no longer opt-in.

I would give some consideration to placing the defaults (ignoring the implicit tie in to the Help) as a preference so the power user or overly motivated scriptwriter could inspect and change. If the preference is empty then mafia fills it using the hard-coded list that the Help is based on. Otherwise the fixed portion of the list is read from the preference.

A small enhancement might be to order the defaults in a MRU order that only manages the defaults. I'd much prefer that mainstat floated to the top of a list rather than remaining halfway down withe the "M"'s and since there are commands whose utility I don't understand it would neat if they just floated to the bottom of the list where I never saw them.

Just some of my thoughts to get something out there. I'll be glad to let you manage the Swing although a case could be made that I should make the effort to learn more than I know.
 

roippi

Developer
Well the part of that I like the most is the core feature part. I tend to dislike hidden opt-in stuff because a minority of people who would want the feature will actually find the feature.

I whipped up a patch in an hour or so. It's a tad bit rough but that only really shows when you start messing with maximizerMRULength. To keep things simple I just extended ScriptMRUList and overrode updateJComboData.

You can mostly ignore the renderer stuff, that's just me wanting the separator bit to work. Swing by default won't let you just drop a JSeparator into a JCombobox (boo), so I quickly googled a solution and just pasted it as an inner class in MaximizerFrame. Like I said, a bit rough. The biggest issue is more code semantics than anything else; PartialMRUList should implement the custom renderer rather than requiring MaximizerFrame to do it.

Anyway, getting off track, seems promising.
 

Attachments

  • partialMRU.patch
    9.1 KB · Views: 16

roippi

Developer
Cleaned up some things locally, essentially ready to commit, modulo input. Implementation specifics that are up for discussion:

- maximizerMRUlength is removed. mazimizerMRUenabled (default: true) takes its place. I could be persuaded to leave ...length and make the default 5 if people really care about adjusting that. 5 just seems right, though.
- add a toggle for mazimizerMRUenabled in Preferences > General.
 

fronobulax

Developer
Staff member
Thanks. Have not tried patch yet but I have no problems with commit and then tweak if no one gives you feedback.

Five seems right to me as well, but is there a downside to keeping the preference and just having it default to five?

At the time this was done there was a general sense that hidden preferences that scratched someone's itch were better than cluttering up the general preferences page. However that page has since been tweaked and the folks implementing the decisions have changed.

One of my most successful software development projects had a preferences file that drove some intensive signal processing and a GUI that allowed users who were challenged by a text editor, to change the preferences. Much of our success stemmed from the decision to only tweak the GUI to show a new preference if it had been proven useful to the power users who were using the software to both develop and refine standard processing algorithms and handle edge cases based upon funky data. So I am comfortable with deliberately hidden preferences but not wedded to them.
 

roippi

Developer
Five seems right to me as well, but is there a downside to keeping the preference and just having it default to five?

Well for one, the pref already exists, so changing the default will leave the feature disabled for extant users who have not yet turned it on. This can be worked around of course by changing the pref name.

The other downside is that if a toggle control is added to Preferences > General, it can only toggle the setting between 0 and 5 - erasing the previous setting if it was set to something other than 5.

Both minor points so I don't really care if we go with that route. Giving people the option to change length does have its upsides.

---------

Aside discussion on hidden preferences:

Hidden preferences do have a place and time. God knows I've personally added enough of them with the quest tracking, familiar trackers, etc.

My change in attitude here derives from the target audience more than anything else. i.e. if we want this change to impact casual users at all, we need to make it opt-out rather than opt-in. Joe Sixpack will simply never find the feature if it is opt-in. That doesn't mean that opt-in features are bad - potentially disruptive features should be off by default. It's a subjective call but I think this feature's potential to be disruptive is low, and the minority of people who find it so can turn it off.

I have more to say but I'm being rushed out the door, so I'll maybe edit this later.
 

roippi

Developer
Alright, r12105. After a little more contemplation I turned maximizerMRULength into maximizerMRUSize (default: 5) and left it as hidden for now. 0 turns it off.

Known bug: increasing the size of maximizerMRUSize may temporarily place the separator line in the wrong place. This will go away as you do maximizations and fill up the MRU list.
 

Fluxxdog

Active member
Question: How do you get the MRUs to appear? I've got a mafia with the MRU set to 5, the list has my last 5 uses in it, but I don't see any of my MRUs. Is there something I'm missing? r12263 if that helps.
\
 

fronobulax

Developer
Staff member
I went through the effort to make a screen capture for you and then I realized that wasn't your question. Most Recently Used.

When you say "the list has my last 5 uses in it, but I don't see any of my MRUs" I would respond with "your last 5 uses are your most recently used maximizer strings." I think one of us is missing something ;-) The MRU does not differentiate between strings that you type and strings that are submitted to the Maximizer by a script. I that is what you want then your best bet is to increase 5 until people figure out whether differentiating between script use and typing. Personally, I like having script use in the MRU because it has allowed me to understand several things that BCCAscend (and other scripts) was doing that didn't quite make sense.
 

Fluxxdog

Active member
OK, lemme put it this way (and thanks for taking the time):

After hand entering several different options in the Maximizer tab, nothing gets added to my dropdown list. I see no separator line. The first thing in my dropdown list is "mainstat" and the last is "+four songs". If I have it update with "mus,melee,1hand", that selection doesn't show anywhere in the list. I have this in my preferences:
Code:
maximizerMRUList (user, now '-mana cost,-tie;slime hates it;-combat;adv;-mana cost, -tie', default 'mainstat;mus;mys;mox;familiar weight;HP;MP;ML;DA;DR;+combat -tie;-combat -tie;initiative;exp;meat drop;item drop;2.0 meat, 1.0 item;item, sea;weapon dmg;ranged dmg;elemental dmg;spell dmg;adv;hot res;cold res;spooky res;stench res;sleaze res;all res;mp regen;ML, 0.001 slime res;4 clownosity;7 raveosity;+four songs')
maximizerMRUSize (user, now '5', default '5')
On a side note, why is the default the entire dropdown list?
 

fronobulax

Developer
Staff member
One.png

Code:
maximizerMRULength=40
maximizerMRUList=item, food drop;0 beeosity, mainstat 999999999 max, +10spell damage +mysticality experience +5 mp regen min +5 mp regen max, item;0 beeosity, mainstat 99 max, +10spell damage +mysticality experience +5 mp regen min +5 mp regen max,;adv;0 beeosity, mainstat 89 max, +10spell damage +mysticality experience +5 mp regen min +5 mp regen max,
maximizerMRUSize=5

The text is from the user preferences file at the time the screen shot was grabbed. I note the presence of both maximizerMRULength and maximizerMRUSize which may be a legacy issue or it may be that both parameters have some meaning. As a hack you might try making sure you have both parameters and making sure Length > Size >= 5. I am very motivated to look at this (since the initial implementation was mine) but I am going off net for a few days so you will have to be patient if no one else steps in.

P.S. - Mine is a literal cut and paste from user_preferences.txt in settings. If yours is also then I am concerned about the differences in formats and formatting. If you did some processing on yours then you might want to verify that the preferences file is what KoLmafia expects (especially in terms of white space) and that your operating system is actually letting KoLmafia write to the file.
 
Last edited:

Winterbay

Active member
It looks like the output of the prefref-alias.
Mine currently says:
Code:
maximizerMRULength=0
maximizerMRUList=adv, switch disembodied hand;item, equip shoulder holder, equip dormouse;item;-tie, Four Songs, Additional Song;mox
maximizerMRUSize=5

BUt the prefref alias, which only shows preferences that have a default Mafia value, says:
Code:
maximizerMRUList (user, now '', default mainstat;mus;mys;mox;familiar      weight;HP;MP;ML;DA;DR;+combat -tie;-combat -tie;initiative;exp;meat      drop;item drop;2.0 meat, 1.0 item;item, sea;weapon dmg;ranged      dmg;elemental dmg;spell dmg;adv;hot res;cold res;spooky res;stench      res;sleaze res;all res;mp regen;ML, 0.001 slime res;4 clownosity;7      raveosity;+four songs)
maximizerMRUSize (user, now '', default 5)

Note the absence of maximizerMRULength, should that perhaps be added to the default values for some non-zero value?
 

Winterbay

Active member
Ok, but since it doesn't work for neither me nor Fluxxdog perhaps some residual code has been left that refers to that setting making it not work for those with that setting not at a reasonable value?
 

Fluxxdog

Active member
Sorry, I forget that the prefref alias can cause problems reporting issues.

I went to check my prefs. Found Length, deleted it. I deleted List also to reset it to default. After starting up again, I confirmed that the default was indeed being used. I then started putting in various strings for the modifier to use in the GUI and ended with this C&P from prefs:
Code:
maximizerMRUList=mox,-melee;mys,type chefstaff,spell damage percent;mus,melee,shield;mus,melee,1 hand;weapon damage percent
maximizerMRUSize=5
Still nothing :( The only thing I can guess is I'm doing something wrong, but I don't know what.

@Winterbay: Looking at the SVN diff, it seems the only real call to Length was just replaced with Size, so Length should have no effect anymore. If it really did, my delete should have had an impact.

Another thought: Any chance of this having something to do with different Java versions?
 
Last edited:

Winterbay

Active member
Ok. maximizerMRULength clearly has something to do with it.
If I delete the setting from my prefs-file and log in I have no maximizer MRU even though there is stuff in the list-setting.
I then call "set maximizerMRULength=0" and nothing changes, if I then do "set maximizerMRULength=40" the MRU-list shows up. GOing back to 0 does not remove it. If I log out and delete the line in the prefs-file and log in again the MRU-list is gone again.

Further testing shows that if I log in with maximizerMRULength set to 0 the list does not show up, but after setting it to any other value (I only tried positive values) it shows up again.

Edit: This on Win7 64 bit and Mafia r12673.
Code:
java -version
java version "1.7.0_17"
Java(TM) SE Runtime Environment (build 1.7.0_17-b02)
Java HotSpot(TM) 64-Bit Server VM (build 23.7-b01, mixed mode)
 
Top