EatDrink.ash: Optimize your daily diet (and see how your old diet stacks up).

Was just noticed by Craggles that if you acquire a tuxedo shirt somewhere without the torso skill, EatDrink will believe it's usable, because mafia's can_equip doesn't actually check if you have the skill and can equip it. Most people won't need the attached version, but for those who have somehow done this, update attached. Changelog since 1260:

Implemented since last mentioned:
1281: Better torso awaregness. Explicitly check for the skill, since mafia doesn't (as of 10216).

To be done - Definitely:
1069: Coinmaster (besides hermit) handling - Need decision on token mall price, item mall price, or lowest of the two - will probably use retrieve_item on tokens but will need custom override for hermit due to available_amount not calculating how many we can get with gum
1200: Work around mafia's new retrieve_item code - mafia recalculates the 'cheapest' way to get something as spending more money and getting more, which sometimes makes ED fail because it's spending more initially, but there might not be a good way to avoid this - Best solution would be more parameters for a speculative RI that tells us how much meat it's spending to save us meat, which we'll probably use for updating the effective price as well
 

Attachments

Last edited:
Sorry if this has been answered before but I'm not finding it when I search...

If I want to call this automatically, how do I do that? I am trying >> eatdrink.ash (15,14,...) and that barfs. Not finding a variable in any directory where can preset those things and if I do "set foodMax" from the CLI, that seems to be ignored by the script.

Fairly certain I'm being stupid, but I can't figure this out...
 
You can call it from a script:
Code:
import "EatDrink.ash";

SIM_CONSUME = true; // or false
eatdrink(fullness_limit(), inebriety_limit(), spleen_limit(), false); // or true to overdrink

or if you want, you can add the following alias to the CLI:
alias ed => ashq import "EatDrink.ash"; boolean overdrink = "%%" == "drink"; SIM_CONSUME = false; eatdrink(fullness_limit(), inebriety_limit(), spleen_limit(), !overdrink);
and to call the alias from the CLI, type "ed" to fill up everything without over-drinking, or "ed drink" to fill up and overdrink.

p.s. I haven't figured out a way to pass more that one parameter via the CLI
 
p.s. I haven't figured out a way to pass more that one parameter via the CLI

You can't, unless the script is specifically designed for it.

Also, my eatdrink alias currently looks like this:
Code:
eatdrink => ash import eatdrink.ash; int value = %%; eatdrink(fullness_limit()-1, inebriety_limit(), spleen_limit(),false,value,5,1,1000,false);

so by calling "eatdrink 1250" I tell eatdrink to use a value_of_adventure of 1250 with all those other settings.
 
eatdrink_getBartender true
eatdrink_getChef true

Code:
> call scripts\EatDrink.ash

Refreshing stash contents...
Stash list retrieved.
Internal checkpoint created.
Skipping favorites.
Starting EatDrink.ash (version 3.1.5).
Consuming up to 15 food, 19 booze, and 15 spleen
Considering food from inventory closet Hagnk's Coinmasters NPCs the mall. Per-item budget cap is 25000.0.
Retrieval cap is 20000. Price will be a factor if you own it already.
An adventure has the value of 1200 meat. Mysticality subpoint is 10.0. Nonprime stat subpoint is 2.0.
Pass 1: food.
Skipping food.
Pass 2: drink.
Skipping drink.
Pass 3: spleen.
Skipping spleen.
Pass 4: drink.
Skipping drink.
choc: Checking non-filling crimbo chocolates - all 3 kinds
chocolate pasta spoon price updated from 3000 to 3000.
FAIL: chocolate pasta spoon lev:0 gain:1.0 adv:3.0 musc:0.0 myst:0.0 mox:0.0 meat:3000 own:0 value:600
chocolate pasta spoon cannot currently be consumed. Skipping.
Finished. You had Milk of Magnesium-Ode to Booze in effect. Adventures listed above does not reflect that, but this does:
Spent 0 meat. Gained Fullness: 0. Inebriety: 0. Spleen: 0.
Adventures: 0. Muscle: 0. Moxie: 0. Mysticality: 0.
Eating, drinking, and spleening complete. Commence merrymaking (at your own discretion).
******************************************
Now, to recap...
******************************************
Starting EatDrink.ash (version 3.1.5).
Consuming up to 15 food, 19 booze, and 15 spleen
Considering food from inventory closet Hagnk's Coinmasters NPCs the mall. Per-item budget cap is 25000.0.
Retrieval cap is 20000. Price will be a factor if you own it already.
An adventure has the value of 1200 meat. Mysticality subpoint is 10.0. Nonprime stat subpoint is 2.0.
choc: Checking non-filling crimbo chocolates - all 3 kinds
Finished. You had Milk of Magnesium-Ode to Booze in effect. Adventures listed above does not reflect that, but this does:
Spent 0 meat. Gained Fullness: 0. Inebriety: 0. Spleen: 0.
Adventures: 0. Muscle: 0. Moxie: 0. Mysticality: 0.
Eating, drinking, and spleening complete. Commence merrymaking (at your own discretion).

Are both true but the script isn't trying to acquire them.
 
eatdrink_getBartender true
eatdrink_getChef true

Are both true but the script isn't trying to acquire them.

I don't see a problem. The settings in question will buy the boxen if necessary but since your sample is not eating or drinking anything there seems to be no reason to buy boxen either. Also note that the ED settings do interact with a lot of mafia settings such as the require and repair boxen and the buy from mall. So, if things are not behaving as you expect, please report those values as well as a bit more detail concerning what you think is not working.
 
Two things, Craggles.
One, it only retrieves them if the script actually acquires any item. The box acquiring is a portion of the active item retrieval code, not a part of the speculation or anything else, so it only does it if you actually need it.
Two, it was added in post 1260, and still remains in 1281. If you aren't using one of these versions... the version attached to post 1, for example... then EatDrink will never actually construct chefs or bartenders.
 
How did I just find this after making a (very unoptimal) spreadsheet for aftercore? This looks to be pretty damned awesome.

Edit: Is there an issue with the script getting Coffe Pixie Sticks? I searched and saw when coinmasters were being implemented in the script, but nothing since then.
 
Last edited:
Well, for the last ~200 posts, we've been waiting for someone to care enough to make the decision on what to price.
1069: Coinmaster (besides hermit) handling - Need decision on token mall price, item mall price, or lowest of the two - will probably use retrieve_item on tokens but will need custom override for hermit due to available_amount not calculating how many we can get with gum
So if you know what you want us to consider as the price, let me know and I'll start working on it. :D My guess is that you'll go with lowest price between token and item if both are available, but...

For example, the coffee pixie sticks you pointed out are untradable. So it won't have a price, and if we only use the mall price of the terminal item, we'll just skip it as an option. Game grid tickets do have a price, though, and currently in the mall at 332 meat each. It takes 10 for coffee pixie sticks, so break-ever on them is where 7.5 adventures costs 3320 meat or less. Right now, that's a tiny bit cheaper than groose grease (3690) and oily paste (3675), both also 7.5 adventures, which is what EatDrink served up for me today.

In rare cases, items might be cheaper to buy directly from the mall than through coinmasters. An example would be ketchup in a softcore run with the hermit unhacked, where the mall sells the item for 100 and it's at least 150 for the permit and worthless item through as a coinmaster. Do we care about this sort of circumstance or do we say that the ketchup is still worth 150 meat (even though mafia will likely end up picking it up for cheaper) and possibly end up missing out on something that's better than the option we actually use?
 
You're doing the work so I don't mind letting you do something and then throwing darts at it ;-) What I would like, and I would like this done mafia wide, would be a setting that says which of the Coinmaster currencies can is considered spendable. For example, I have been farming lucre, forgotten to closet it and then had EatDrink (correctly) get Bounty-O's for dinner. So, If automation is allowed to spend then for mallable currencies it should use the mall price. For non-mallable, if I am allowed to spend then treat them as free. But, whatever you do will be all right since you are doing the work.
 
What I'm planning on doing for them is using the other EatDrink values. If we do end up having someone say what's considered acquirable (token/item/both), if that item isn't available, use the other EatDrink settings to value it.
So if we're just valuing the tokens, anything purchasable through the bounty hut would be using PRICE_OF_NONTRADEABLES to set the value for the filthy lucre.
If we're just using the item, anything from the bounty hut would still be using PRICE_OF_NONTRADEABLES to set the value for the item, since you can't buy it. I'd suggest we avoid using just the item price, since the items are rarely available that way and are often not available that way, so the coffee pixie stick would be using the non-tradeable price because you can't buy them from the mall.
If we use both, then if either one is available, we use whichever is cheapest as our option, as mafia will when retrieving the item. In this case, filthy lucre and bounty items should still use PRICE_OF_NONTRADEABLES since neither one is tradeable.

We might eventually allow for coinmaster price overrides, similar to how we have avoid and favourite foods. If eatdrink_coinmaster<token> is set, use it as the value needed for that token. If value is not set, use the mall pricing on token (or item, if we do both).

Actually, one way we could do this is by starting with mall pricing on everything. If it doesn't have a price, THEN check for $item.seller. (This is where the override would go in, eventually.) If seller is set, check mall price on $item.seller.item. If our price is above 0, multiply that by sell_price($item.seller, $item) to find out how much it costs for the tokens to actually get the item. Does that logic seem sound?
 
Well, I know it's a nice situation, but yeah, Pixie Sticks for either the price of 10 Game Grid tickets or the cost of 1 Game Grid token, then redeemed for 10 tickets through Skeeball, then redeemed for a Pixie Stick.

The ticket price one is likely simpler to add though.
 
Yeah... skeeball isn't actually a 'coinmaster' per se. :) So WE can't know how the token translates into tickets without a bunch of custom code.

If, for some reason, mafia does, then retrieve_item will do whatever is cheapest. But that's on mafia, since we don't have a speculative retrieve_item that will tell us how much we're looking to spend and from what source. :)

Edit: Well, since I talked my way through it in post 1292...
> ash import <EatDrink.ash>; effective_price($item[coffee pixie stick], false);

Returned: 3390

> ash import <EatDrink.ash>; effective_price($item[groose grease], false);

Returned: 3400
Now I just need to tweak the retrieval code. But it looks like this may happen sooner than later. Only major difference between coinmaster and regular pricing is that AUTOSELL_RONIN doesn't apply to coinmaster tokens, since we don't really care if you can sell them for cheap... we still care about if you can get more. Note also that the hermit does remain a problem...
> ash import <EatDrink.ash>; effective_price($item[ketchup], false);

Returned: 10
That's my quest item price. Ketchup is not a quest item. So I've put in an override for him, specifically.
> ash import <EatDrink.ash>; effective_price($item[ketchup], false);

Returned: 50

Anyways, can't think of anything else that really needs doing with the pricing part. So I'll be working on availability and retrieval now. Might need to mark somehow how we're getting this, but I might just say that if it's a coinmaster item and either side is available, go for it... It should work, since pricing should only take the available information and skip unavailable.

Edit2: Also fixed a bug where I'd done a bad min/max on starter items, so it thought I had 233 instead of 13. Whenever this version gets spun, it should be a bit better on painful penne pasta and pr0n cocktails as well.

Edit3: On a level 6 character with dramatic range and cocktailcrafting, but not much in terms of supplies.
Starting EatDrink.ash (version 3.1.5).
Consuming up to 15 food, 14 booze, and 15 spleen
Considering food from inventory Coinmasters NPCs the mall. Per-item budget cap is 12500.0.
Retrieval cap is 10000. Price will be a factor if you own it already.
An adventure has the value of 1250 meat. Muscle subpoint is 10.0. Nonprime stat subpoint is 2.0.
Simulating only; no purchases or food/drink/spleen consumption.
food: At 0, consuming to 15 with 2893 meat.
1: gnocchetti di Nietzsche lev:6 gain:6.0 adv:25.0 musc:0.0 myst:49.5 mox:0.0 meat:1900 own:0 value:4908
2: painful penne pasta lev:3 gain:3.0 adv:8.0 musc:18.5 myst:0.0 mox:0.0 meat:190 own:0 value:3331
3: enchanted bean burrito lev:2 gain:3.0 adv:6.0 musc:0.0 myst:15.0 mox:0.0 meat:250 own:1 value:2426
4: enchanted bean burrito lev:2 gain:3.0 adv:6.0 musc:0.0 myst:15.0 mox:0.0 meat:250 own:1 value:2426
drink: At 0, consuming to 14 with 193 meat.
1: fruity girl swill lev:4 gain:4.0 adv:12.0 musc:2.5 myst:28.0 mox:2.5 meat:1355 own:0 value:3432
2: tropical swill lev:4 gain:4.0 adv:12.0 musc:28.0 myst:2.5 mox:2.5 meat:1803 own:0 value:3371
3: blended frozen swill lev:4 gain:4.0 adv:12.0 musc:2.5 myst:2.5 mox:28.0 meat:3690 own:0 value:2849
4: Cobb's Knob Wurstbrau lev:4 gain:1.0 adv:2.5 musc:5.0 myst:0.0 mox:0.0 meat:601 own:2 value:2574
5: Cobb's Knob Wurstbrau lev:4 gain:1.0 adv:2.5 musc:5.0 myst:0.0 mox:0.0 meat:601 own:2 value:2574
spleen: At 0, consuming to 15 with -7857 meat.
choc: Checking non-filling crimbo chocolates - all 3 kinds
Finished.
Spent 110 meat for a value of 10640 meat. Gained Fullness: 15. Inebriety: 14. Spleen: 0.
Adventures: 86. Muscle: 60. Moxie: 32. Mysticality: 111.
Eating, drinking, and spleening complete. Commence merrymaking (at your own discretion).
That's using the new coinmaster code, and it's still making a painful penne pasta from the hermit... The reason I'm not spinning this quite yet is due to it not being as smart about how/when to estimate. It should be fine... but I'd like to run it a day or two first, both in run and aftercore, before unleashing it. :)
 
Last edited:
I haven't tested it without previously casting, but will this use Inigo's if you have it, to cast up to the required number of crafting turns (if available to)?

In other words, I call EatDrink for 19 Booze. It suggests 9 Crimbojitos and one Cup of Primitive Beer. Crimbojitos each require one adventure to craft, as they're Fancy. If I have Inigo's, but for some crazy reason have a Stolen Accordion as opposed to a RnR Legend, it would cast Inigo's the max 5 times, giving me 5 free crafts, and using adventures for the other 4. If I have an RnR Legend, it would cast it the same 5 times, but not use adventures for any of them.

Not sure how you'd handle this. If no, it's no biggie, I can just as easily cast it prior.
 
Nope, no auto-Inigo. If you want it, cast it first. For now. If I ever get Inigo myself on various characters, it might be automated. For now, you can get chefs and bartenders automatically, but Inigo is more complicated.
 
It looks like EatDrink is getting confused by the new candy items from this Crimbo that have both fullness and drunkenness. I just caught it stuck in a loop trying to use a green drunki-bear to finish out my drunkenness, running into two problems in the process; my fullness was already full, and it was trying to use the "drink" command to consume it, failing, and just looping back and trying again. (Sorry if this has already been posted, but a quick skim and search of the thread didn't turn up anything.)
 
It looks like EatDrink is getting confused by the new candy items from this Crimbo that have both fullness and drunkenness. I just caught it stuck in a loop trying to use a green drunki-bear to finish out my drunkenness, running into two problems in the process; my fullness was already full, and it was trying to use the "drink" command to consume it, failing, and just looping back and trying again. (Sorry if this has already been posted, but a quick skim and search of the thread didn't turn up anything.)

I'm having the exact same problem: (from the CLI)

green drunki-bear is not an alcoholic beverage.
FAIL: green drunki-bear lev:6 gain:4.0 adv:24.0 musc:0.0 myst:220.0 mox:0.0 meat:5000 own:1 value:7750)
 
Looks like r10247 is the cause of this. I doubt that the drunki-whatevers are likely to be optimal in many circumstances so maybe they could be skipped altogether somehow?
 
Back
Top