Difference between revisions of "Whatif"

From Kolmafia
Jump to navigation Jump to search
imported>Bale
(there's no template for CLI commands, is there?)
 
imported>Bale
Line 17: Line 17:
 
<p>Example:</p>
 
<p>Example:</p>
 
<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 Knob Goblin elite helm; equip Knob Goblin elite polearm; equip Knob Goblin elite 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("_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>

Revision as of 11:18, 8 April 2010

speculate
whatif

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:

  • 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.
  • 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("_spec", "Buffed MP Maximum"))
   print("Bad idea - you'd lose MP by doing that.");