eat

From Kolmafia
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
1 int amount = (fullness_limit() - my_fullness()) / 3;
2 eat(amount, $item[olive lo mein]);
1 const { eat, fullnessLimit, myFullness } = require("kolmafia");
2 
3 const amount = Math.floor((fullnessLimit() - myFullness()) / 4);
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()