Modifier Maximizer

Rinn

Developer
Is there a keyword that will make the maximizer fold equipment from the cli if necessary?
 

Winterbay

Active member
I believe that it is said in the UI of the modifier maximizer that folding is not yet supported, but I don't have Mafia open atm so can't check. If so I would guess there is no keyword for it.
 

Fluxxdog

Active member
Which is funny considering there's a button for creatable/foldable. Part of the TBD list. The day shall complete when the Maximizer is complete and all shall love it and despair!

... Too much LotR lately.
 

Theraze

Active member
Simple reason, because the dev who owns the maximizer doesn't want it in there. Maybe at some point when the maximizer is 'complete' and will not receive any more features, functionality, or other such things (alluding to his comment on maximizer improvements), something like this may be included... until then, homebrew updates without official support are as close as you'll get. Unless your goal is to make him ignore the maximizer in the future...
 

Fluxxdog

Active member
It's just frustrating. I have such beautiful plans that I can't do because of just that one thing.<sigh> You're right.
 

Theraze

Active member
Well, you could directly replicate your desired behaviour without hacking the code by running your inventory into an array, capturing the string of the maximizer, and checking if an inventory item from the array exists in the maximizer string, and discarding it from the array if it doesn't. That should allow for any future code changes to happen without issue. The only issue you may have is cases where the best option is multiple of an item.
 

Fluxxdog

Active member
Well, you could directly replicate your desired behaviour without hacking the code by running your inventory into an array, capturing the string of the maximizer, and checking if an inventory item from the array exists in the maximizer string, and discarding it from the array if it doesn't. That should allow for any future code changes to happen without issue. The only issue you may have is cases where the best option is multiple of an item.
OK, question then: what "string of the maximizer"?
 

Theraze

Active member
Hmm... I was hoping that maximize? would actually display what it wanted to do, instead of just telling you how many options it was looking through. Wield? displays what you currently have... <sighs>

I keep hoping to find a good way to capture CLI command text directly into a buffer or string, not just the boolean of whether or not it completed successfully. If there was a good way to do that, you could accomplish what you wanted by making an outfit for current, outfit birthday, (captured) maximize <whatever>, outfit wear current. Three server hits instead of the wide sweep, and the same hits as opening the relay browser and having main pane, char pane, and the top pane... less if you count that it also loads changes/chat.

Again though, that only works if there's a way to capture CLI output to a buffer/string. :( If I come up with a way (or someone has a way to do it), shouldn't be hard to do all sorts of pretty things.
 

Fluxxdog

Active member
I feel ya on the whole "cli_execute() returns boolean only" issue. The big issue with gear is you can only equip one item at a time, and this is AFAIK a KoL limitation, not mafia. Heck, even tried a little URL manipulation to see if I could eek around it. Nope, only one item at a time. And outfits are stored internally in KoL by number, not by items, and those are internally generated.

<sigh> I have a map that I created for working with gear on mafia's side that I derived from the whole design code I worked on earlier. Basically:
Code:
typedef item[slot]uniform; //A map of slots containing items
uniform current_gear(){ //Saves a snapshot of your current gear
	uniform tempuni;
	foreach place in $slots[acc1,acc2,acc3,weapon,offhand,hat,pants,shirt]{
		tempuni[place]=equipped_item(place);
		debug_print("Saving: "+place+" contains "+equipped_item(place));}
	return tempuni;}
void wear_uniform(uniform oldschool){ //Wear a defined uniform
	foreach place in $slots[acc1,acc2,acc3,weapon,offhand,hat,pants,shirt]{
		if(equipped_item(place)!=oldschool[place]){
			debug_print("Equipping: "+place+" with "+equipped_item(place));
			equip(place,oldschool[place]);}}}
Then when I have something that needs to change outfits automatically, like doing the Junkyard during the war, I can start a script with "uniform pre_junkyard=current_gear()" and if I need to change back to it, I use "wear_uniform(pre_junkyard)" which comes in very handy as I'd rather not do the Junkyard in the war outfits.
On that vein of thought, using maximize("whatever") could provide maps for testing with speculate or even a "speculate maximize". In fact, to my knowledge, speculate/whatif is the ONLY CLI command that returns information that can be used by an ASH script other than a boolean in the form of _spec.
 

slyz

Developer
I'm trying to use the Maximizer to decide which 2 handed club is best for Mother Hellseal killing with Lunging thrust-Smack. I'm using this expression:
Code:
muscle, 2 hand, type club

The maximizer simply doesn't propose to equip any weapon.

Adding the "dump" keyword results in this:
Code:
Maximizing...
SLOT 0
[stainless steel skullcap (1,542)]
SLOT 1
[creepy-ass club (257)]
SLOT 2
[Brimstone Bunker (257)]
SLOT 3
[sea salt scrubs (257)]
SLOT 4
[Greatest American Pants (257)]
SLOT 5
[fossilized necklace (257), Slow Talkin' Elliot's dogtags (257), fancy black tie (257)]
SLOT 6
[]
SLOT 7
[]
SLOT 8
[sugar shield (257)]
SLOT 9
[]
SLOT 10
[glow-in-the-dark wristwatch (513)]
SLOT 11
[]
12 combinations checked, best score 362.0

If I'm reading the code correctly, the slot numbers in the dump correspond to:
SLOT 0: HAT
SLOT 1: WEAPON_2H
SLOT 2: OFFHAND
SLOT 3: SHIRT
SLOT 4: PANTS
SLOT 5: ACCESSORY
SLOT 6: OFFHAND_MELEE
SLOT 7: OFFHAND_RANGED
SLOT 8: FAMILIAR
SLOT 9: ?
SLOT 10: WATCHES
SLOT 11: WEAPON_1H

I see a 2 handed club (creepy-ass club) is considered, and I do have one in my inventory, but I don't understand why the Maximizer doesn't equip it or show it in the GUI:
Code:
> outfit birthday suit

Taking off everything...
Everything removed.

> maximize muscle, 2 hand, type club

Maximizing...
12 combinations checked, best score 362.0
Putting on stainless steel skullcap...
Equipment changed.
Putting on sea salt scrubs...
Equipment changed.
Putting on Greatest American Pants...
Equipment changed.
Putting on fossilized necklace...
Equipment changed.
Putting on Slow Talkin' Elliot's dogtags...
Equipment changed.
Putting on fancy black tie...
Equipment changed.
Putting on sugar shield...
Equipment changed.

Could it be that the offhand item (Brimstone Bunker) is considered better to equip than the creepy-ass club, eliminating the club, but ends up being discarded because of the "2 hand" keyword?

I tried adding "-offhand" (and " -1000000 offhand" just in case), but I get exactly the same result, including the dump.

EDIT: I'm getting this now, even after restarting Mafia:
Code:
> maximize muscle, 2 hand, type club, dump

Maximizing...
SLOT 0
[stainless steel skullcap (536,872,454)]
SLOT 1
[creepy-ass club (257)]
SLOT 2
[Brimstone Bunker (257)]
SLOT 3
[sea salt scrubs (536,871,169)]
SLOT 4
[Greatest American Pants (536,871,169)]
SLOT 5
[fossilized necklace (536,871,169), Slow Talkin' Elliot's dogtags (536,871,169), fancy black tie (536,871,169)]
SLOT 6
[]
SLOT 7
[]
SLOT 8
[sugar shield (536,871,169)]
SLOT 9
[]
SLOT 10
[glow-in-the-dark wristwatch (513)]
SLOT 11
[]
12 combinations checked, best score 362.0

The numbers on most slots seem to have changed (536,871,169?). I think this happened after i tried messing with " -1000000 offhand".
 
Last edited:

Theraze

Active member
Well, +weapon means only the weapon slot while -offhand means skip the offhand slot, consider everything else... No clue why it hates your club though. :(
 

Winterbay

Active member
I got an interesting debug log today when I did a "maximize spell damage -spooky" in order to try and get the maximizer to not equip my spooky spellbook. The result was "unrecoginzed keyword spooky" and a debuglog containing a null pointer exception:
Code:
Unexpected error, debug log printed.
class java.lang.NullPointerException: null
java.lang.NullPointerException
	at net.sourceforge.kolmafia.swingui.MaximizerFrame.maximize(MaximizerFrame.java:330)
	at net.sourceforge.kolmafia.textui.command.ModifierMaximizeCommand.run(ModifierMaximizeCommand.java:54)
	at net.sourceforge.kolmafia.KoLmafiaCLI.executeCommand(KoLmafiaCLI.java:538)
	at net.sourceforge.kolmafia.KoLmafiaCLI.executeLine(KoLmafiaCLI.java:412)
	at net.sourceforge.kolmafia.swingui.CommandDisplayFrame$CommandQueueHandler.handleQueue(CommandDisplayFrame.java:202)
	at net.sourceforge.kolmafia.swingui.CommandDisplayFrame$CommandQueueHandler.run(CommandDisplayFrame.java:183)

I don't like getting debuglogs. It feels like I've done soemthing bad :)
Also, afterwards mafia got stuck in a pending state no matter what I did.
 

slyz

Developer
Try with "-Spooky Spell Damage".

By the way, The maximizer only recognizes the keywords explained in the help, or any keyword that appears when you type "modref" in the gCLI.
 

Rinn

Developer
Hey look at this thing I did:

Code:
> ashref maximize


boolean maximize( string, boolean )
boolean maximize( string, int, int, boolean )
int [effect] maximize_effect_array( string )
int [effect] maximize_effect_array( string, int, int )
item [slot] maximize_equipment_slots( string )
item [slot] maximize_equipment_slots( string, int, int )


> ash maximize_effect_array( "mp regen max" )

 
Maximizing (1st time may take a while)...
96 combinations checked, best score 81.0
Returned: aggregate int [item]
Antarctic Memories => 0
Black Tongue => 4
Chlorophyll Flavor => 10
Fiery Heart => 11
Fit To Be Tide => 7
Florid Cheeks => 1
Heart of Orange => 9
Mental A-cue-ity => 8
Purple Tongue => 2
Stimulated Brain => 5
The Real Deal => 3
Tiny Bubbles in the Cupcake => 6


> ash maximize_equipment_slots( "mp regen max" )


Maximizing...
96 combinations checked, best score 81.0
Returned: aggregate item [slot]
acc1 => vampire pearl earring
acc2 => vampire pearl ring
acc3 => Bling of the New Wave
familiar => Mayflower bouquet
hat => jewel-eyed wizard hat
off-hand => hilarious comedy prop
pants => plexiglass pants
shirt => snailmail hauberk
weapon => lawn dart


> ash maximize( "mp regen max", false )


Maximizing...
96 combinations checked, best score 81.0
Putting on jewel-eyed wizard hat...
Equipment changed.
Wielding lawn dart...
Equipment changed.
Holding hilarious comedy prop...
Equipment changed.
Putting on snailmail hauberk...
Equipment changed.
Putting on plexiglass pants...
Equipment changed.
Putting on vampire pearl earring...
Equipment changed.
Putting on vampire pearl ring...
Equipment changed.
Putting on Bling of the New Wave...
Equipment changed.
Putting on Mayflower bouquet...
Equipment changed.
Returned: true


> ash maximize_equipment_slots( "mp regen max" )


Maximizing...
128 combinations checked, best score 81.0
Returned: aggregate item [slot]

Thoughts? Should I just make one set of functions that returns an array of records containing an item, effect, and slot instead of the two different function sets? There are limitations, there's no handling for exclusive effects, effects need to be checked manually for how much they would effect a character, and if there's some equipment requirement (special sauce glove for equipping a chefstaff for example) there's nothing giving you an equip order. Are these worth being able to get the info I'm providing?

Edit: Thinking about this more, while you can probably get all the info you need manually by looking at the effect\equipment record, I feel like this would be much more useful if more info was returned from the Boost object.

Edit Again: Looking back Jason had a lot of the same thoughts earlier in the thread when someone else made a patch, all of which were very good points. At the very least I have a good handle on debugging mafia and adding ash functions now, so that's something.
 

Attachments

  • maximizer.patch
    5.4 KB · Views: 29
Last edited:

Fluxxdog

Active member
Found a bug, of sorts. When I ask it to maximize Critical, it'll recommend a stainless steel shillelagh and a tiki lighter, even though the shillelagh has a 4x and makes the lucky lighter (2x) worthless. What also odd is it doesn't also recommend my filigreed hamethyst earring (3x).
 
Top