eatsilent()

From KoLMafia
Jump to: navigation, search

Function Syntax

boolean eatsilent(int qty ,item consume )

  • qty is the quantity to eat
  • consume is the item to eat

Will attempt to eat qty amount of item consume. Returns true for food items and false for items that are not. (The return value does not reflect whether or not the items were actually consumed.) Using this function, rather than eat(), will suppress the warning dialogs that may otherwise appear, such as for eating without Got Milk.

Code Samples

Eats the cheapest Hi Meins while suppressing the warning about no milk of magnesium.

if (can_interact() && get_property("autoSatisfyWithMall") == "true") {
   int current;
   int best;
   item food;
   foreach it in $items[] {
      if (contains_text(it, "hi mein")) {
         current = mall_price(it);
         if (current < best || best == 0) {
            best = current;
            food = it;
         }
      }
   }
   int amount = floor((fullness_limit() - my_fullness())/food.fullness);
   //Eat the food without warnings
   if (buy (amount, food))
      eatsilent(amount, food);
   else print("Failed to buy the amount for some reason...", "red");
}
else print("You currently can not use the mall....", "red");
Eatsilent is best used when the "Got Milk" buff is not present. Common occurrences include eating fortune cookies or using only one milk of magnesium that only gives 10 adventures.

CLI Equivalent

The CLI command "eat" works similarly.

See Also