Whatif: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
imported>Bale
No edit summary
imported>Eliteofdelete
Updated "_spec" and added some additional information. Might have broke formatting.
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
speculate<br />
{{DISPLAYTITLE:whatif (CLI)}}
whatif
alias: '''speculate'''


<p>This takes a semicolon-separated list of commands that change the character state, and displays the modifier changes that would occur due to executing those commands. The supported commands are:</p>
<p>This is a CLI command that takes a semicolon-separated list of commands that change the character state, and displays the modifier changes that would occur due to executing those commands. The supported commands are:</p>
* MCD <num>
* MCD <num>
* equip [<slot>] <item>
* equip [<slot>] <item>
* unequip <slot>
* unequip <slot>
* familiar <type> - note that this doesn't change the current familiar item, whether or not the specified familiar can equip it.
* familiar <type> - note that this doesn't change the current familiar item, whether or not the specified familiar can equip it.
* enthrone <familiar> - considers the effect of having the specificed familiar in the crown of thrones
* up <effect> - considers you to have 1 turn of that effect.
* up <effect> - considers you to have 1 turn of that effect.
* uneffect <effect>
* uneffect <effect>
Line 18: Line 19:
<div style="margin-bottom: 1em; border: dashed 1px green; padding: 1em; margin:0px 20px;"><syntaxhighlight>
<div style="margin-bottom: 1em; border: dashed 1px green; padding: 1em; margin:0px 20px;"><syntaxhighlight>
cli_execute("whatif equip KGE helm; equip KGE polearm; equip KGE pants; quiet");
cli_execute("whatif equip KGE helm; equip KGE polearm; equip KGE pants; quiet");
if (my_mp() > numeric_modifier("_spec", "Buffed MP Maximum"))
if (my_mp() > numeric_modifier("Generated:_spec", "Buffed MP Maximum"))
   print("Bad idea - you'd lose MP by doing that.");
   print("Bad idea - you'd lose MP by doing that.");
</syntaxhighlight></div>
</syntaxhighlight></div>
<br>
See [https://kolmafia.us/showthread.php?17831-Querying-speculated-modifiers-doesn-t-seem-to-work-after-modifier-revamp&highlight=whatif here] and [https://kolmafia.us/showthread.php?17825-15461-Refactor-modifiers-txt-to-specify-modifier-type-Any-ash-modifier-functions-th here] for more information.
[[Category:CLI Commands]]

Latest revision as of 07:16, 19 September 2019

alias: speculate

This is a CLI command that takes a semicolon-separated list of commands that change the character state, and displays the modifier changes that would occur due to executing those commands. The supported commands are:

  • MCD <num>
  • equip [<slot>] <item>
  • unequip <slot>
  • familiar <type> - note that this doesn't change the current familiar item, whether or not the specified familiar can equip it.
  • enthrone <familiar> - considers the effect of having the specificed familiar in the crown of thrones
  • up <effect> - considers you to have 1 turn of that effect.
  • uneffect <effect>
  • quiet - suppresses the display of changed modifiers, for use in scripts.

Note that speculation about impossible actions is allowed - there's no checking to verify that you actually have any item, or can equip it. The predicted modifiers are stored as an object named "_spec", which can be referenced by any of the ASH modifier query functions.

Five derived modifiers were added for use with this command, with values predicted from your base stats and other modifiers: "Buffed Muscle", "Buffed Mysticality", "Buffed Moxie", "Buffed HP Maximum", and "Buffed MP Maximum". They are of little use with the character's current modifiers, since the actual values of these attributes are available, but are quite useful with the modifiers resulting from a speculation.

Example:

cli_execute("whatif equip KGE helm; equip KGE polearm; equip KGE pants; quiet");
if (my_mp() > numeric_modifier("Generated:_spec", "Buffed MP Maximum"))
   print("Bad idea - you'd lose MP by doing that.");


See here and here for more information.