Drink

From Kolmafia
Revision as of 14:05, 13 July 2021 by Philmasterplus (talk | contribs) (Rewrite page to use Template:Function2. Also add info on clear_booze_helper().)
Jump to navigation Jump to search

{{Function2 |name=drink |function1.return_type=boolean |function1.description=Attempts to drink the booze item(s). |function1.param1=booze |function1.param1.description=Item to drink |function1.param2=qty |function1.param2.description=Amount to drink |function1.param2.optional=yes |function1.param2.default=1 |function2.return_type=boolean |function2.description=Attempts to drink qty of booze. |function2.param1=qty |function2.param1.description=Amount to drink |function2.param2=booze |function2.param2.description=Item to drink

|description=

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.

|code1=

Code Sample

Drinks as many tangaritas as possible without getting drunk.

ASH JavaScript
1 int amount = floor((inebriety_limit() - my_inebriety()) / 4);
2 drink(amount, $item[tangarita]);
1 const { drink, inebrietyLimit, myInebriety } = require("kolmafia");
2 
3 const amount = Math.floor((inebrietyLimit() - myInebriety()) / 4);
4 drink(amount, Item.get('tangarita'));