Bug - Fixed Modifier Maximizer glitch

Cait

Member
I'm trying to do the Nemesis quest in aftercore, and thus told the Modifier Maximizer to maximize "0.5 MP Regen Min, 0.5 MP Regen Max +equip 17-alarm saucepan". This spits out an "Unrecognized keyword: equip" error.

Further testing indicates that this results from any piece of equipment whose name starts with a number; "+equip 1337 7r0uZ0RZ" is broken, but "+equip red-and-green sweater" is fine (thus eliminating hyphens as a factor).
 
It looks like the maximizer doesn't know how to handle the equip keyword when used with words that start with a number:

PHP:
 > maximize moxie +equip 7-Foot Dwarven mattock

Unrecognized keyword: equip
Unable to meet all requirements via equipment changes.
See the Modifier Maximizer for further suggestions.

> maximize moxie +equip Foot Dwarven mattock

Maximizing...
168 combinations checked, best score 1420.0
Wielding 7-Foot Dwarven mattock...
Equipment changed.

> maximize moxie +equip 7-inch discus

Unrecognized keyword: equip
Unable to meet all requirements via equipment changes.
See the Modifier Maximizer for further suggestions.

> maximize moxie +equip 9-ball

Unrecognized keyword: equip
Unable to meet all requirements via equipment changes.
See the Modifier Maximizer for further suggestions.

> maximize moxie +equip X-37 gun

Maximizing...
168 combinations checked, best score 1487.0
Removing items from closet...
You acquire an item: X-37 gun
Wielding X-37 gun...
Equipment changed.
Holding vinyl shield...
Equipment changed.
 

slyz

Developer
Here is the RegEx the Maximizer uses to parse the expression:
Code:
"\\G\\s*(\\+|-|)([\\d.]*)\\s*((?:[^-+,0-9]|(?<! )[-+0-9])+),?\\s*"
// Groups: 1=sign 2=weight 3=keyword
The issue seems to be the "(?<! )", which is necessary so that "+equip 17-alarm 15 familiar weight" doesn't become a single keyword.

The Maximizer checks if the keyword starts with "equip ", so doing "equip17-alarm" also won't fool it.

I'm not really sure what to do with it. Maybe remove the space in
Code:
keyword.startsWith( "equip " )
so people can use "equip17-alarm" as a workaround?
 

Theraze

Active member
Alternatively, in the case of your above example, people could adapt to using "+equip 17-alarm, 15 familiar weight" or with some other valid delineator instead of leaving the gapping to mafia...
 

Nifft

Member
Something simple like:

Attempting: maximize +equip 5-alarm

Result: Unrecognized keyword: +equip

So it isn't just about the delineator between separate request pieces.
 
In the meantime you can simply leave out the number and it works just fine.

"equip alarm saucepan" does exactly what it needs to do.

The only case I see this being an issue is the numbered pool balls. But really, how often do you need them?
 

Winterbay

Active member
Well, you have the problem of choosing between a 5- and a 17-alarm saucepan which you can't do if you for some reason would want to do it. Which one would it choose if I had one of both?
 

Bale

Minion
The issue seems to be the "(?<! )", which is necessary so that "+equip 17-alarm 15 familiar weight" doesn't become a single keyword.

How about making "equip" an exception to that rule? Numbers not starting with space, unless the previous token is "equip" in which case numbers are allowed? Negative look-behind gives me a headache so I'll let someone else figure out the regex.
 

Theraze

Active member
If you actually needed to pick between them, you could just equip 17-alarm manually, then maximize moxie, -weapon.
 

Raijinili

Member
I forgot how to read regex (already?) but I don't see any reason to follow a number-that's-a-number with anything that's not a space.
 

Winterbay

Active member
In the meantime you can simply leave out the number and it works just fine.

"equip alarm saucepan" does exactly what it needs to do.

The only case I see this being an issue is the numbered pool balls. But really, how often do you need them?

Nope, you can't apparently...
Code:
> maximize spell damage, +equip alarm saucepan

Maximizing (1st time may take a while)...
10080 combinations checked, best score 425.0 (FAIL)
Pulling items from storage...
Putting on big bad voodoo mask...
Equipment changed.
Pulling items from storage...
Wielding Staff of the Grease Trap...
Equipment changed.
Pulling items from storage...
Holding big bumboozer marble...
Equipment changed.
Pulling items from storage...
Putting on flyest of shirts...
Equipment changed.
Pulling items from storage...
Putting on Brimstone Brooch...
Equipment changed.
Pulling items from storage...
Putting on plexiglass pinky ring...
Equipment changed.
Pulling items from storage...
Putting on Ankh of Badahnkadh...
Equipment changed.
Putting on sugar shield...
Equipment changed.
Unable to meet all requirements via equipment changes.
See the Modifier Maximizer for further suggestions.
 

jasonharper

Developer
r10531 allows you to quote a keyword that contains words starting with a digit, for example:
+"equip 17-alarm saucepan"

This also allows commas in the keyword, but breaks down on quote marks. As usual, if you're trying to generate the command programmatically, the best solution is to use the item's ID, rather than its name:
maximize("+equip \u00B6" + to_int($item[17-alarm saucepan]));
 

Theraze

Active member
Using 10532, the modifier maximizer suggests equipping weapons offhand when I don't have dual-wielding...
Maximizing (1st time may take a while)...
8 combinations checked, best score 1323.2
Maximizing...
208 combinations checked, best score 1384.2
Pulling items from storage...
19 pulls remaining,0 budgeted for automatic use.
Wielding world's smallest violin...
Equipment changed.
Pulling items from storage...
18 pulls remaining,0 budgeted for automatic use.
Holding world's smallest violin...
You can't dual wield weapons.
 
Top