Maximize: Difference between revisions
imported>Bale This is now an ash command as of r8954 |
imported>Cheesecookie _spec was changed to Generated:_spec in r15467. Added example of usage to clarify how the speculative data can be used. |
||
(5 intermediate revisions by 4 users not shown) | |||
Line 2: | Line 2: | ||
#vardefine:name|maximize}}{{ | #vardefine:name|maximize}}{{ | ||
#vardefine:return_type|boolean}}{{ | #vardefine:return_type|boolean}}{{ | ||
#vardefine:return_type2|record}}{{ | |||
FunctionPage| | FunctionPage| | ||
Line 12: | Line 13: | ||
return_also={{#var:return_also}}| | return_also={{#var:return_also}}| | ||
parameter1={{Param|string|expression}}| | parameter1={{Param|string|expression}}| | ||
parameter2={{Param| | parameter2={{Param|boolean|simulate}}| | ||
}}| | }}| | ||
Line 21: | Line 22: | ||
return_also={{#var:return_also}}| | return_also={{#var:return_also}}| | ||
parameter1={{Param|string|expression}}| | parameter1={{Param|string|expression}}| | ||
parameter2={{Param|int| | parameter2={{Param|int|max_price}}| | ||
parameter3={{Param|int| | parameter3={{Param|int|price_level}}| | ||
parameter4={{Param|string|simulate}}| | parameter4={{Param|boolean|simulate}}| | ||
}}| | |||
function3={{Function| | |||
name={{#var:name}}| | |||
aggregate=yes| | |||
return_type=record [int]| | |||
return_also={{#var:return_also}}| | |||
parameter1={{Param|string|expression}}| | |||
parameter2={{Param|int|max_price}}| | |||
parameter3={{Param|int|price_level}}| | |||
parameter4={{Param|boolean|simulate}}| | |||
parameter5={{Param|boolean|include_equip}}| | |||
p1desc={{Pspan|expression}} is the list of modifiers to maximize for.| | p1desc={{Pspan|expression}} is the list of modifiers to maximize for.| | ||
p2desc={{Pspan| | p2desc={{Pspan|max_price}} limits how much meat will be spent on maximization.| | ||
p3desc={{Pspan| | p3desc={{Pspan|price_level}} controls checking the mall and affects return value.| | ||
p4desc={{Pspan|simulate}} will not equip gear if | p4desc={{Pspan|simulate}} will not equip gear if true.| | ||
p5desc={{Pspan|include_equip}} will return a record including equipment and effects if true, otherwise only effects| | |||
}}| | }}| | ||
function_description=This command will run the [[modifier maximizer]] and return true if successful. If a minimum is applied to a modifier and that minimum could not be accomplished (such as 4 clownosity) then it will return false.</p> | function_description=This command will run the [[modifier maximizer]] and return true if successful. If a minimum is applied to a modifier and that minimum could not be accomplished (such as 4 clownosity) then it will return false.</p> | ||
<p>This function will set _spec so that it can be checked with {{f|numeric_modifier}}. That is the main purpose of using a true value for {{ | <p>This function will set "Generated:_spec" so that it can be checked with {{f|numeric_modifier}}. That is the main purpose of using a true value for {{Pspan|simulate}} as shown in the following code:</p> | ||
<syntaxhighlight> | |||
maximize("cold resistance, spooky resistance", true); | |||
print(numeric_modifier("Generated:_spec", "cold resistance")); | |||
print(numeric_modifier("Generated:_spec", "Maximum HP")); | |||
print(numeric_modifier("Generated:_spec", "Spooky Resistance")); | |||
</syntaxhighlight> | |||
<p>If {{Pspan|max_price}} is <= 0, it will use the preference autoBuyPriceLimit, or available meat, whichever is lower. Otherwise, that's the value it's considering as the max value for new items.</p> | |||
<p> | |||
If {{Pspan|price_level}} is greater than 0, Mall price is considered. If {{Pspan|price_level}} is 2, always consider mall price. If {{Pspan|price_level}} is 1, only consider it if there isn't another way. | |||
Also, if {{Pspan|price_level}} is 0 or less, validateItem always returns true.</p> | |||
<p>When using the 5-parameter version, a record will be returned of the format: | |||
<syntaxhighlight> | |||
record { | |||
string display; //What would be shown in the Modifier Maximizer tab | |||
string command; //The CLI command the Maximizer would execute | |||
float score; //The score added from equipping the item or gaining 1 turn of the effect | |||
effect effect; //The effect you would gain | |||
item item; //The item being used or equipped | |||
skill skill; //The skill you need to cast | |||
}; | |||
</syntaxhighlight> | |||
When {{Pspan|include_equip}} is true, the first items in the record array are equipment. If you are only looking for effects that you can combine with maximized equipment, a better set of parameters might be (using Prismatic Damage as an example): | |||
<syntaxhighlight>maximize("Prismatic Damage",0,0,false,false);</syntaxhighlight> | |||
...which would equip items giving you bonus Prismatic Damage and return an array that can boost your score higher with certain effects. Keep in mind, these effects only count 1 turn of the effect, so effects that vary with more turns will likely no be represented properly. | |||
| | |||
needscode=yes| | needscode=yes| | ||
cli_equiv=The CLI command command "maximize" will automatically change equipment as if the | cli_equiv=The CLI command command "maximize" will automatically change equipment as if the {{Pspan|simulate}} parameter was false.| | ||
more_info=See the page on the [[Modifier Maximizer]] for more information on how to use this, especially to create a meaningful expression.| | more_info=See the page on the [[Modifier Maximizer]] for more information on how to use this, especially to create a meaningful expression.| | ||
}} | }} | ||
{{RFI|What is | {{RFI|What exactly is validateItem? What does it mean to us?}} | ||
[[Category:Equipment]] | [[Category:Equipment]] |
Latest revision as of 03:46, 5 January 2016
Function Syntax
boolean maximize(string expression ,boolean simulate )
boolean maximize(string expression ,int max_price ,int price_level ,boolean simulate )
record [int] maximize(string expression ,int max_price ,int price_level ,boolean simulate ,boolean include_equip )
- expression is the list of modifiers to maximize for.
- max_price limits how much meat will be spent on maximization.
- price_level controls checking the mall and affects return value.
- simulate will not equip gear if true.
- include_equip will return a record including equipment and effects if true, otherwise only effects
This command will run the modifier maximizer and return true if successful. If a minimum is applied to a modifier and that minimum could not be accomplished (such as 4 clownosity) then it will return false.
This function will set "Generated:_spec" so that it can be checked with numeric_modifier()
. That is the main purpose of using a true value for simulate as shown in the following code:
maximize("cold resistance, spooky resistance", true);
print(numeric_modifier("Generated:_spec", "cold resistance"));
print(numeric_modifier("Generated:_spec", "Maximum HP"));
print(numeric_modifier("Generated:_spec", "Spooky Resistance"));
If max_price is <= 0, it will use the preference autoBuyPriceLimit, or available meat, whichever is lower. Otherwise, that's the value it's considering as the max value for new items.
If price_level is greater than 0, Mall price is considered. If price_level is 2, always consider mall price. If price_level is 1, only consider it if there isn't another way. Also, if price_level is 0 or less, validateItem always returns true.
When using the 5-parameter version, a record will be returned of the format:
record {
string display; //What would be shown in the Modifier Maximizer tab
string command; //The CLI command the Maximizer would execute
float score; //The score added from equipping the item or gaining 1 turn of the effect
effect effect; //The effect you would gain
item item; //The item being used or equipped
skill skill; //The skill you need to cast
};
When include_equip is true, the first items in the record array are equipment. If you are only looking for effects that you can combine with maximized equipment, a better set of parameters might be (using Prismatic Damage as an example):
maximize("Prismatic Damage",0,0,false,false);
...which would equip items giving you bonus Prismatic Damage and return an array that can boost your score higher with certain effects. Keep in mind, these effects only count 1 turn of the effect, so effects that vary with more turns will likely no be represented properly.
CLI Equivalent
The CLI command command "maximize" will automatically change equipment as if the simulate parameter was false.
More Information
See the page on the Modifier Maximizer for more information on how to use this, especially to create a meaningful expression.
Attention KoLmafia Experts!
We need your help; some details of this function's operation are unknown or unclear.
The following specific question has been raised:
- What exactly is validateItem? What does it mean to us?