Eatsilent: Difference between revisions
Jump to navigation
Jump to search
imported>Bale mNo edit summary |
imported>Eliteofdelete No edit summary |
||
Line 19: | Line 19: | ||
function_description=Will attempt to eat {{pspan|qty}} amount of item {{pspan|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 {{f|eat}}, will suppress the warning dialogs that may otherwise appear, such as for eating without Got Milk.| | function_description=Will attempt to eat {{pspan|qty}} amount of item {{pspan|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 {{f|eat}}, will suppress the warning dialogs that may otherwise appear, such as for eating without Got Milk.| | ||
code1={{CodeSample| | |||
title=Code Samples| | |||
description=Eats the cheapest Hi Meins while suppressing the warning about no milk of magnesium.| | |||
code= | |||
<syntaxhighlight> | |||
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"); | |||
</syntaxhighlight>| | |||
moreinfo= | |||
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. | |||
}}| | |||
see_also={{SeeAlso|can_eat|eat|fullness_limit|my_fullness}}| | see_also={{SeeAlso|can_eat|eat|fullness_limit|my_fullness}}| |
Latest revision as of 08:49, 11 January 2015
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.