Difference between pages "Maximize" and "Waitq"

From Kolmafia
(Difference between pages)
Jump to navigation Jump to search
imported>Cheesecookie
(_spec was changed to Generated:_spec in r15467. Added example of usage to clarify how the speculative data can be used.)
 
imported>StDoodle
(Created page with '{{ #vardefine:name|waitq}}{{ #vardefine:return_type|void}}{{ FunctionPage| name={{#var:name}}| function1={{Function| name={{#var:name}}| aggregate={{#var:aggregate}}| return_t…')
 
Line 1: Line 1:
 
{{
 
{{
#vardefine:name|maximize}}{{
+
#vardefine:name|waitq}}{{
#vardefine:return_type|boolean}}{{
+
#vardefine:return_type|void}}{{
#vardefine:return_type2|record}}{{
 
  
 
FunctionPage|
 
FunctionPage|
 +
 
name={{#var:name}}|
 
name={{#var:name}}|
  
Line 12: Line 12:
 
return_type={{#var:return_type}}|
 
return_type={{#var:return_type}}|
 
return_also={{#var:return_also}}|
 
return_also={{#var:return_also}}|
parameter1={{Param|string|expression}}|
+
parameter1={{Param|int|secs}}|
parameter2={{Param|boolean|simulate}}|
+
p1desc={{pspan|secs}} is the number of seconds you want to delay further action.
 
}}|
 
}}|
  
function2={{Function|
+
function_description=This function will initiate a countdown from {{pspan|secs}} seconds to 0, during which time nothing else will be acted on. It essentially pauses a script. This is the "quiet" version, which will not print a countdown on the gCLI during the delay.|
name={{#var:name}}|
 
aggregate={{#var:aggregate}}|
 
return_type={{#var:return_type}}|
 
return_also={{#var:return_also}}|
 
parameter1={{Param|string|expression}}|
 
parameter2={{Param|int|max_price}}|
 
parameter3={{Param|int|price_level}}|
 
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.|
 
p2desc={{Pspan|max_price}} limits how much meat will be spent on maximization.|
 
p3desc={{Pspan|price_level}} controls checking the mall and affects return value.|
 
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>
 
 
 
<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|
 +
see_also={{SeeAlso|wait}}|
 +
cli_equiv=The CLI command "waitq" functions the same and can be used to pause basic .txt scripts.|
 +
}}
  
cli_equiv=The CLI command command "maximize" will automatically change equipment as if the {{Pspan|simulate}} parameter was false.|
+
[[Category:Miscellaneous Functions]]
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?}}
 
[[Category:Equipment]]
 

Revision as of 18:21, 27 November 2010

needs(code_samples);

Function Syntax

void waitq(int secs )

  • secs is the number of seconds you want to delay further action.

This function will initiate a countdown from secs seconds to 0, during which time nothing else will be acted on. It essentially pauses a script. This is the "quiet" version, which will not print a countdown on the gCLI during the delay.

CLI Equivalent

The CLI command "waitq" functions the same and can be used to pause basic .txt scripts.

See Also

wait()