eat

From Kolmafia
Revision as of 14:32, 13 July 2021 by Philmasterplus (talk | contribs) (Add Template:SeeAlso/Food Management)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Function Syntax

boolean eatitem food, int? qty = 1 )

Attempts to eat the food item(s).
  • food: Item to eat
  • qty: Amount to eat

boolean eatint qty, item food )

Attempts to eat qty of item.
  • qty: Amount to eat
  • food: Item to eat

Attempts to eat qty amount of the food item. Returns true for edible 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 "eat" food helper items (e.g. Ol' Scratch's salad fork) to queue them before eating the actual food item. Food helpers can be identified with item_type(), which returns "food helper" for such items. To cancel all queued food helpers, call clear_food_helper().

If you can use milk of magnesium but haven't used one yet, this command will show a warning dialog.

Code Sample

Eats as many olive lo meins as possible.

ASH JavaScript
int amount = (fullness_limit() - my_fullness()) / 3;
eat(amount, $item[olive lo mein]);
const { eat, fullnessLimit, myFullness } = require("kolmafia");

const amount = Math.floor((fullnessLimit() - myFullness()) / 4);
drink(amount, Item.get('olive lo mein'));

CLI Equivalent

The CLI command eat works similarly.

See Also

can_eat() | clear_food_helper() | eat() | eatsilent()