Maximize: Difference between revisions
imported>Fluxxdog Add 5 parameter version |
imported>Cheesecookie _spec was changed to Generated:_spec in r15467. Added example of usage to clarify how the speculative data can be used. |
||
(One intermediate revision by one other user not shown) | |||
Line 46: | Line 46: | ||
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 {{Pspan|simulate}} | <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|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> | ||
Line 72: | Line 78: | ||
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 exactly is validateItem? What does it mean to us?}} | {{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?