Drink: Difference between revisions
Rewrite page to use Template:Function2. Also add info on clear_booze_helper(). |
m Fix template error |
||
Line 39: | Line 39: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{!}}} | {{!}}} | ||
}} | |||
|cli_equiv=The CLI command <code>drink</code> works similarly. | |cli_equiv=The CLI command <code>drink</code> works similarly. | ||
}} | }} | ||
</onlyinclude> | </onlyinclude> | ||
[[Category:Item Management]] | [[Category:Item Management]] |
Revision as of 14:06, 13 July 2021
Function Syntax
- Attempts to drink the booze item(s).
- Attempts to drink qty of booze.
Attempts to drink qty amount of the booze item. Returns true
for drinkable items and false
for items that are not. (The return value does not reflect whether or not the items were actually consumed.)
You can also "drink" drink helper items (e.g. divine champagne flute) to queue them before drinking the actual booze item. Drink helpers can be identified with item_type()
, which returns "drink helper"
for such items. To cancel all queued drink helpers, call clear_booze_helper()
.
If this command will cause you to overdrink, KoLmafia will show a warning dialog. Using this command without Ode to Booze active will also show a warning, if you have the skill and the MP required to cast it.
Code Sample
Drinks as many tangaritas as possible without getting drunk.
ASH | JavaScript |
---|---|
int amount = floor((inebriety_limit() - my_inebriety()) / 4);
drink(amount, $item[tangarita]);
|
const { drink, inebrietyLimit, myInebriety } = require("kolmafia");
const amount = Math.floor((inebrietyLimit() - myInebriety()) / 4);
drink(amount, Item.get('tangarita'));
|
CLI Equivalent
The CLI command drink
works similarly.