eat
Function Syntax
boolean eat( item food, int? qty = 1 )
- Attempts to eat the food item(s).
- food: Item to eat
- qty: Amount to eat
boolean eat( int 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.