Eatsilent: Difference between revisions
Jump to navigation
Jump to search
imported>StDoodle Created page with '{{ #vardefine:name|eatsilent}}{{ #vardefine:return_type|boolean}}{{ FunctionPage| name={{#var:name}}| function_category=Item Management| function1={{Function| name={{#var:name}…' |
imported>Eliteofdelete No edit summary |
||
(One intermediate revision by one other user not shown) | |||
Line 5: | Line 5: | ||
FunctionPage| | FunctionPage| | ||
name={{#var:name}}| | name={{#var:name}}| | ||
function1={{Function| | function1={{Function| | ||
Line 20: | 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}}| | ||
cli_equiv=The CLI command "eat" works similarly.| | cli_equiv=The CLI command "eat" works similarly.| | ||
}} | }} | ||
[[Category:Item Management]] |
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.