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

Ditto. I note that it preferred new Crimbo stuff over my normal diet which is usually meins and tps drinks. When this is dealt with, let's call the working version a new release.
 
Well, I was going to delay on spinning this, but... Use 1281 if you notice anything screwy with coinmasters, or this if you want to help test and/or avoid the drunki-bears. So... changelog since 1281:

Implemented since last mentioned:
1069: Coinmaster (besides hermit) handling - Using lowest of the two prices, with a custom override for the hermit to set the value of his items at the price of a permit (if needed) and the cost of acquiring a worthless item - using retrieve_item on tokens, so it should decide if it's cheaper for buying directly from the mall or using the coinmaster.
1298: Skip items which fill multiple organs - while it may be optimal on one, it's unlikely to be optimal to both.

To be done - Definitely:
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

Edit: One note. This version just has the old hermit code commented out, because I wanted to make sure that the new code was working solidly before scrapping the old stuff. I've only ever had it take one hermit-food so far unlike with the older version, so if someone has it eat 2 painful penne pastas in the same series, let me know. I'll clean up the code and remove the hermit ingredient collection code as well as the legacy hermit availability code. Thanks.
 

Attachments

Last edited:
Well, that answers the "can multiple coinmaster items still get picked" question.
food: At 0, consuming to 15 with 10845 meat.
EatDrink encountered an error: You don't have 1 milk of magnesium and you're not able to shop.
1: painful penne pasta lev:3 gain:3.0 adv:8.0 musc:18.5 myst:0.0 mox:0.0 meat:190 own:1 value:3282
2: painful penne pasta lev:3 gain:3.0 adv:8.0 musc:18.5 myst:0.0 mox:0.0 meat:190 own:1 value:3282
3: painful penne pasta lev:3 gain:3.0 adv:8.0 musc:18.5 myst:0.0 mox:0.0 meat:190 own:1 value:3282
4: painful penne pasta lev:3 gain:3.0 adv:8.0 musc:18.5 myst:0.0 mox:0.0 meat:190 own:1 value:3282
5: painful penne pasta lev:3 gain:3.0 adv:8.0 musc:18.5 myst:0.0 mox:0.0 meat:190 own:1 value:3282
Slightly smaller version attached with legacy hermit code removed. Also decided to clean up the sloppy 2 space-after-period bits, so... hopefully won't have caused any problems with that. :)
 

Attachments

Did you guys ever make any progress on getting ED to use spleen clearing items like the jar of fermented pickle juice? I remember a discussion a while back, but I didn't follow the results too closely (at all). Also, feature request: Given a budget of X meat, have ED obtain the absolute maximum possible number of adventures without spending more than X meat. Is this already possible? If so please inform me :)
 
I don't recall spleen clearing status.

Your feature request is probably not going to happen. As a mathematician with somewhat anal tendencies, I see your request as a constrained optimization problem which - while oft discussed - is much more difficult than what ED actually accomplishes. A workaround, implemented in Ascend, is to put a wrapper around ED so everything outside of budget is in the closet while ED runs. The attached is (untested by me) code that Theraze (I believe) tweaked when the wrapper question came up before. That comes close to what you want except that milk, cast of ODE, MP restores, boxen, ovens and so on will also come out of that budget if ED is allowed to use/purchase them.

@Theraze - a) Should we make the wrapper an optional part of ED? b) Should we honor 15.0 by releasing an ED update?
 

Attachments

Hmm... well, could include the code inside ED... wouldn't be too much of an issue, but I'm thinking it shouldn't be a part of main, just an extra function. If we wanted to.

Probably should do a new release at some point. Let me look at everything that happened since. Changelog is everything since 1202.

Implemented:
1069: Coinmaster (besides hermit) handling - Using lowest of the two prices, with a custom override for the hermit to set the value of his items at the price of a permit (if needed) and the cost of acquiring a worthless item - using retrieve_item on tokens, so it should decide if it's cheaper for buying directly from the mall or using the coinmaster.
1205: Fixed mojo filter infinite loop.
1226: Removed the verbose and verbose2 functions, replacing them with a vprint3 and vprint9. Items that were always printing before are still using logprint, print, or print_html as appropriate.
1259: Finally implemented the GET_BARTENDER and GET_CHEF bits. These have (of longstanding) been set by EatDrink to default to false, but never (that I could find) did anything. Now they will get you a bartender or chef and install them if have_bartender/chef returns false and you have them set to true, while the item retrieval happens.
1260: Fixed another mojo filter loop.
1281: Better torso awaregness. Explicitly check for the skill, since mafia doesn't (as of 10216). Note that mafia does check as of 10220, but the explicit check won't hurt and helps keep people using out of date mafia for some reason running properly.
1298: Skip items which fill multiple organs - while it may be optimal on one, it's unlikely to be optimal to both.
1303: Removed legacy hermit code, since the new coinmaster code properly purchases from him as well as potentially from other coinmasters.
 
I've been using the latest (1303 now) each day you release it in beta, and haven't had any issues...(the drunki-bears I couldn't figure out with omnivore until you pointed out that they were drunk food) I am having periodic issues with it in-run, but I only simulate there anyway...

Thanks for all the work you are putting into this!
 
Not a problem. :) Let me know if you run into in-run issues. I use EatDrink in and out of runs, and haven't noticed any issues, so... if you see problems, I'd like to fix them. :)
 
The issues I have is that it wants to eat more expensive things (probably more optimal) than I want it to...(like drinking the overpriced beer, when you are saving up to buy skills)...I've really only had major issues with that in BM runs...
 
If you don't want it to spend any money, run it with STEP_MEAT set to 0. Then it will just use your inventory. If you're using an alias to run it, can easily just make it run that on a check... based on your total meat, based on your level, or based on your path. Here's an alias that would run with STEP_MEAT at 0 if you have less than 3000 meat, for example:
alias eatdrink => ashq import <EatDrink.ash>; if (my_meat() < 3000) STEP_MEAT=0; SIM_CONSUME=false; eatdrink(fullness_limit(), inebriety_limit(), spleen_limit(), false);

One thing I do need to try to implement is items with limited additional availability. Whatever's in the gnome/logging stores, as well as the bad moon shop, needs to be added to the available-during-HC list. At some point. Just putting this out though so I can note it later and hopefully remember to implement it. :)
 
Here we go... hopefully this one should include the limited availability items. Should be good, but let me know if you notice any problems. It just checks if the daily_special() == the item in question, and if so, marks it as available through NPC stores. Let me know if it causes problems... if it does, it will be due to that you probably can't retrieve_item on it like normal... I may need to make a new item category for it. Anyways, here's the changelog for the prior bits plus this one. Yell if it tries and doesn't work properly.

Implemented:
1069: Coinmaster (besides hermit) handling - Using lowest of the two prices, with a custom override for the hermit to set the value of his items at the price of a permit (if needed) and the cost of acquiring a worthless item - using retrieve_item on tokens, so it should decide if it's cheaper for buying directly from the mall or using the coinmaster.
1205: Fixed mojo filter infinite loop.
1226: Removed the verbose and verbose2 functions, replacing them with a vprint3 and vprint9. Items that were always printing before are still using logprint, print, or print_html as appropriate.
1259: Finally implemented the GET_BARTENDER and GET_CHEF bits. These have (of longstanding) been set by EatDrink to default to false, but never (that I could find) did anything. Now they will get you a bartender or chef and install them if have_bartender/chef returns false and you have them set to true, while the item retrieval happens.
1260: Fixed another mojo filter loop.
1281: Better torso awaregness. Explicitly check for the skill, since mafia doesn't (as of 10216). Note that mafia does check as of 10220, but the explicit check won't hurt and helps keep people using out of date mafia for some reason running properly.
1298: Skip items which fill multiple organs - while it may be optimal on one, it's unlikely to be optimal to both.
1303: Removed legacy hermit code, since the new coinmaster code properly purchases from him as well as potentially from other coinmasters.
1310: Implemented initial daily special code. Uses normal NPC code currently...

Edit: Earlier version didn't actually work. This version did drink 6 supernova champagnes from the gnomes today. Tweaked the display, because it said it failed, but... should be fully working now, I hope. Needed to add a "canDaily" and "mustDaily" to consumption records, so now it knows if it's possible, and if it has to be done.
 

Attachments

Last edited:
Setting the stepmeat value to 200 did much better (I still wanted it to be able to make the stuff), but I did notice a variance between the 'simulation' and the 'actual'

In the simulation, it had me drink shots of orange and grapefruit schnapps (I had some oranges and grapefruit), but in the actual, I drank all tomato schnapps (I had no tomatos)

simulation:
PHP:
Starting EatDrink.ash (version 3.1.5).
Consuming up to 13 food, 14 booze, and 0 spleen
Considering food from inventory NPCs the mall. Per-item budget cap is 25000.0.
Retrieval cap is 20000. Price will not 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 10.0.
Simulating only; no purchases or food/drink/spleen consumption.
food: At 0, consuming to 13 with 200 meat.
1: Knoll lo mein lev:6 gain:4.0 adv:17.5 musc:32.0 myst:0.0 mox:0.0 meat:1200 own:0 value:5330
2: pr0n m4nic0tti lev:3 gain:4.0 adv:11.0 musc:0.0 myst:0.0 mox:29.0 meat:200 own:0 value:3372
3: creamsicle lev:3 gain:1.0 adv:2.5 musc:9.0 myst:9.0 mox:9.0 meat:110 own:0 value:3270
4: delicious noodles lev:3 gain:3.0 adv:7.5 musc:0.0 myst:0.0 mox:17.0 meat:0 own:1 value:3056
5: desiccated apricot lev:2 gain:1.0 adv:2.0 musc:16.0 myst:0.0 mox:0.0 meat:0 own:2 value:2560
drink: At 0, consuming to 14 with 60 meat.
1: cream stout lev:3 gain:1.0 adv:2.5 musc:9.0 myst:9.0 mox:9.0 meat:675 own:0 value:3270
2: cream stout lev:3 gain:1.0 adv:2.5 musc:9.0 myst:9.0 mox:9.0 meat:675 own:0 value:2595
3: flute of flat champagne lev:2 gain:2.0 adv:4.0 musc:0.0 myst:15.0 mox:0.0 meat:172 own:0 value:2475
4: flute of flat champagne lev:2 gain:2.0 adv:4.0 musc:0.0 myst:15.0 mox:0.0 meat:172 own:0 value:2389
5: shot of orange schnapps lev:1 gain:1.0 adv:2.0 musc:4.0 myst:0.0 mox:0.0 meat:240 own:0 value:2440
6: shot of orange schnapps lev:1 gain:1.0 adv:2.0 musc:4.0 myst:0.0 mox:0.0 meat:240 own:0 value:2200
7: shot of orange schnapps lev:1 gain:1.0 adv:2.0 musc:4.0 myst:0.0 mox:0.0 meat:240 own:0 value:2200
8: shot of orange schnapps lev:1 gain:1.0 adv:2.0 musc:4.0 myst:0.0 mox:0.0 meat:240 own:0 value:2200
9: shot of orange schnapps lev:1 gain:1.0 adv:2.0 musc:4.0 myst:0.0 mox:0.0 meat:240 own:0 value:2200
10: shot of grapefruit schnapps lev:1 gain:1.0 adv:2.0 musc:0.0 myst:4.0 mox:0.0 meat:0 own:1 value:2440
11: shot of grapefruit schnapps lev:1 gain:1.0 adv:2.0 musc:0.0 myst:4.0 mox:0.0 meat:0 own:1 value:2440
12: shot of grapefruit schnapps lev:1 gain:1.0 adv:2.0 musc:0.0 myst:4.0 mox:0.0 meat:0 own:1 value:2440
choc: Checking non-filling crimbo chocolates - all 3 kinds
Finished.
Spent 0 meat for a value of 4404 meat. Gained Fullness: 13. Inebriety: 14. Spleen: 0.
Adventures: 69. Muscle: 95. Moxie: 73. Mysticality: 69.
Eating, drinking, and spleening complete. Commence merrymaking (at your own discretion).

actual:
PHP:
Starting EatDrink.ash (version 3.1.5).
Consuming up to 13 food, 14 booze, and 0 spleen
Considering food from inventory NPCs. Per-item budget cap is 25000.0.
Retrieval cap is 20000. Price will not 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 10.0.
food: At 0, consuming to 13 with 200 meat.
EatDrink encountered an error: You don't have 1 milk of magnesium and you're not able to shop.
1: Knoll lo mein lev:6 gain:4.0 adv:17.5 musc:32.0 myst:0.0 mox:0.0 meat:1200 own:0 value:5330
2: pr0n m4nic0tti lev:3 gain:4.0 adv:11.0 musc:0.0 myst:0.0 mox:29.0 meat:200 own:0 value:3372
3: creamsicle lev:3 gain:1.0 adv:2.5 musc:9.0 myst:9.0 mox:9.0 meat:110 own:0 value:3270
4: delicious noodles lev:3 gain:3.0 adv:7.5 musc:0.0 myst:0.0 mox:17.0 meat:0 own:1 value:3056
5: desiccated apricot lev:2 gain:1.0 adv:2.0 musc:16.0 myst:0.0 mox:0.0 meat:0 own:2 value:2560
drink: At 0, consuming to 14 with 200 meat.
1: cream stout lev:3 gain:1.0 adv:2.5 musc:9.0 myst:9.0 mox:9.0 meat:675 own:0 value:3270
2: cream stout lev:3 gain:1.0 adv:2.5 musc:9.0 myst:9.0 mox:9.0 meat:675 own:0 value:2595
3: flute of flat champagne lev:2 gain:2.0 adv:4.0 musc:0.0 myst:15.0 mox:0.0 meat:172 own:0 value:2475
4: flute of flat champagne lev:2 gain:2.0 adv:4.0 musc:0.0 myst:15.0 mox:0.0 meat:172 own:0 value:2389
5: shot of tomato schnapps lev:1 gain:1.0 adv:2.0 musc:1.5 myst:1.5 mox:1.5 meat:0 own:1 value:2445
6: shot of tomato schnapps lev:1 gain:1.0 adv:2.0 musc:1.5 myst:1.5 mox:1.5 meat:0 own:1 value:2445
7: shot of tomato schnapps lev:1 gain:1.0 adv:2.0 musc:1.5 myst:1.5 mox:1.5 meat:0 own:1 value:2445
8: shot of tomato schnapps lev:1 gain:1.0 adv:2.0 musc:1.5 myst:1.5 mox:1.5 meat:0 own:1 value:2445
9: shot of tomato schnapps lev:1 gain:1.0 adv:2.0 musc:1.5 myst:1.5 mox:1.5 meat:0 own:1 value:2445
10: shot of tomato schnapps lev:1 gain:1.0 adv:2.0 musc:1.5 myst:1.5 mox:1.5 meat:0 own:1 value:2445
11: shot of tomato schnapps lev:1 gain:1.0 adv:2.0 musc:1.5 myst:1.5 mox:1.5 meat:0 own:1 value:2445
12: shot of tomato schnapps lev:1 gain:1.0 adv:2.0 musc:1.5 myst:1.5 mox:1.5 meat:0 own:1 value:2445
Finished.
Spent 1248 meat. Gained Fullness: 13. Inebriety: 14. Spleen: 0.
Adventures: 69. Muscle: 85. Moxie: 89. Mysticality: 73.
Eating, drinking, and spleening complete. Commence merrymaking (at your own discretion).
 
If you look at the actual, it did calculate the tomato schnapps as slightly higher in the value side... also, since "own:1" on that one, it means that you had 9 finished tomato schnapps in your inventory at the beginning of execution... no crafting needed. That's probably why it preferred them, because they cost ~70 meat less each due to not needing to be crafted.

It appears from the "own:0" on the simulation that it had been thinking about crafting from non-inventoried items (or using up all you had), but decided to save the meat later.
 
From the simulation:
Code:
Considering food from inventory NPCs the mall.
From the actual:
Code:
Considering food from inventory NPCs.
 
Well spotted. That makes a difference as well. :)

So, made it display the same for simulating and not, regarding the mall. It SHOULD have been thinking the same before... but it might not have been. Specifically, we turn off EAT_MALL if get_ronin() is true now whether or not SIM_CONSUME is true or false.

So, changelog time:
Implemented:
1069: Coinmaster (besides hermit) handling - Using lowest of the two prices, with a custom override for the hermit to set the value of his items at the price of a permit (if needed) and the cost of acquiring a worthless item - using retrieve_item on tokens, so it should decide if it's cheaper for buying directly from the mall or using the coinmaster.
1205: Fixed mojo filter infinite loop.
1226: Removed the verbose and verbose2 functions, replacing them with a vprint3 and vprint9. Items that were always printing before are still using logprint, print, or print_html as appropriate.
1259: Finally implemented the GET_BARTENDER and GET_CHEF bits. These have (of longstanding) been set by EatDrink to default to false, but never (that I could find) did anything. Now they will get you a bartender or chef and install them if have_bartender/chef returns false and you have them set to true, while the item retrieval happens.
1260: Fixed another mojo filter loop.
1281: Better torso awaregness. Explicitly check for the skill, since mafia doesn't (as of 10216). Note that mafia does check as of 10220, but the explicit check won't hurt and helps keep people using out of date mafia for some reason running properly.
1298: Skip items which fill multiple organs - while it may be optimal on one, it's unlikely to be optimal to both.
1303: Removed legacy hermit code, since the new coinmaster code properly purchases from him as well as potentially from other coinmasters.
1310: Implemented initial daily special code. Uses working special code now... should be fully working, but need someone to have this trigger again.
1314: Made "the mall" display the same whether simulating or actually consuming. This might speed up simulating executions for some people.
 

Attachments

Last edited:
So, I've been using eatdrink.ash in aftercore for a while, and there's a couple of things about its handling of spleen/mojo filters and chocolate items that's made me wonder... Here's an extract from today's running of the script:

Code:
choc: Checking non-filling crimbo chocolates - all 3 kinds
Waiting to consume...
chocolate stolen accordion lev:0 gain:1.0 adv:3.0 musc:0.0 myst:0.0 mox:0.0 meat:3100 own:0 value:2900
Countdown: 3 seconds...
Countdown: 2 seconds...
Countdown: 1 second...
Waiting completed.
chocolate stolen accordion price updated from 3100 to 3100.
FAIL: chocolate stolen accordion lev:0 gain:1.0 adv:3.0 musc:0.0 myst:0.0 mox:0.0 meat:3100 own:0 value:2900
chocolate stolen accordion cannot currently be consumed. Skipping.
Finished.

(...)

******************************************
Now, to recap...
******************************************
Starting EatDrink.ash (version 3.1.5).
Consuming up to 9 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 2000 meat. Moxie subpoint is 0.0. Nonprime stat subpoint is 0.0.

(...)

spleen: At 0, consuming to 15 with 10017501 meat.
1: coffee pixie stick lev:4 gain:4.0 adv:7.5 musc:0.0 myst:0.0 mox:0.0 meat:3330 own:11 value:2917
2: coffee pixie stick lev:4 gain:4.0 adv:7.5 musc:0.0 myst:0.0 mox:0.0 meat:3330 own:11 value:2917
M1: mojo filter price: 2200
M2: mojo filter price: 2794
3: coffee pixie stick lev:4 gain:4.0 adv:7.5 musc:0.0 myst:0.0 mox:0.0 meat:3330 own:11 value:2917
4: prismatic wad lev:7 gain:3.0 adv:6.0 musc:55.0 myst:55.0 mox:55.0 meat:5175 own:0 value:2275
spleen: At 13, consuming to 15 with 10006107 meat.
1: twinkly wad lev:6 gain:1.0 adv:1.0 musc:9.0 myst:9.0 mox:9.0 meat:400 own:0 value:1600
2: twinkly wad lev:6 gain:1.0 adv:1.0 musc:9.0 myst:9.0 mox:9.0 meat:400 own:0 value:1600
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 52093 meat. Gained Fullness: 8. Inebriety: 19. Spleen: 15.
Adventures: 205. Muscle: 541. Moxie: 263. Mysticality: 269.
Eating, drinking, and spleening complete. Commence merrymaking (at your own discretion)

As far as I can see, it shouldn't be buying two mojo filters to consume two extra twinkly wads with the settings I'm using, but it does. It should however consume two chocolate accordions, but it doesn't. Is there something I've missed while setting it up, or is it an issue with the actual script?
 
The reason for the mojo filters is because you're valuing an adventure at 2000 meat, and it can do better than that with coffee pixie sticks and prismatic wads. The reason why it used twinkly wads instead of the good stuff is because you left the retrieval cap (STEP_MEAT) at 20000.

Two good things. One, the log above has coffee pixie sticks, so coinmasters are working properly. Two, I have this log:
Purchasing shot of pear schnapps at the The Gnomish Micromicrobrewery...
You gain 7 Adventures
You gain 14 Wizardliness
You gain 2 Drunkenness
You spent 525 Meat
You lose some of an effect: Ode to Booze
Goodie purchased.
5: shot of pear schnapps lev:8 gain:2.0 adv:6.0 musc:0.0 myst:17.0 mox:0.0 meat:525 own:0 value:3504
So, that's the daily special working too.

This being said, I need to look at chocolates, apparently. I don't think anyone has actually used them during the whole time I've been working on ED. :D
 
Last edited:
Hmm. So is there any easy way to make it consider if it'll actually have room to consume the better stuff after using the mojo filters?
 
Not really. Because it all depends on everything prior. What we should do though is make it recalculate the whole stack if it does use mojo filters immediately, so that it can decide if there's better stuff available based on the new total spleen size. The attached script should both buy/eat chocolates and recalculate immediately if mojo filters are used. Also removed some useless fooddone/drinkdone/spleendone/overdrinkdone variables that were set and never actually used after, which was a little bizarre. Anyways... it's changelog time.

Implemented:
1069: Coinmaster (besides hermit) handling - Using lowest of the two prices, with a custom override for the hermit to set the value of his items at the price of a permit (if needed) and the cost of acquiring a worthless item - using retrieve_item on tokens, so it should decide if it's cheaper for buying directly from the mall or using the coinmaster.
1205: Fixed mojo filter infinite loop.
1226: Removed the verbose and verbose2 functions, replacing them with a vprint3 and vprint9. Items that were always printing before are still using logprint, print, or print_html as appropriate.
1259: Finally implemented the GET_BARTENDER and GET_CHEF bits. These have (of longstanding) been set by EatDrink to default to false, but never (that I could find) did anything. Now they will get you a bartender or chef and install them if have_bartender/chef returns false and you have them set to true, while the item retrieval happens.
1260: Fixed another mojo filter loop.
1281: Better torso awaregness. Explicitly check for the skill, since mafia doesn't (as of 10216). Note that mafia does check as of 10220, but the explicit check won't hurt and helps keep people using out of date mafia for some reason running properly.
1298: Skip items which fill multiple organs - while it may be optimal on one, it's unlikely to be optimal to both.
1303: Removed legacy hermit code, since the new coinmaster code properly purchases from him as well as potentially from other coinmasters.
1310: Implemented initial daily special code. Uses working special code now... should be fully working, but need someone to have this trigger again.
1314: Made "the mall" display the same whether simulating or actually consuming. This might speed up simulating executions for some people.
1316: Added the acquisition of chocolates to the chocolate consumption code, so it should properly use them if you're actually in that budget range.
1316: Made the script recalculate what to consume if either a consumption fails or mojo filters are used, since either is likely to affect how much room is left to fill.
 

Attachments

Thanks for the update :) It's really amazing how fast you did it - I had a quick look at the code and couldn't make heads or tails of it :)
 
Back
Top