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

omg lol... turns out the version I ran sim'd was the one in post 211, not 213 (which I pulled earlier today). The version in 213 was uploaded in super verbose mode and when I ran it and saw my screen full of stuff I thought OMG mafia's gonna explose lmao! I'd never tried it in super verbose mode before lol
 
Yep, exactly. And farm.ash and ascend.ash won't run with the update, so I will just run it directly and give some results of how it works.

EDIT: Ok, I am currently running the script. Good so far, and no error's. I'd say it's running calculations 75% faster. When the script was started 5 popup windows came up asking me:
1: FoodMax - I chose 15
2: DrinkMax - I chose 19
3: SpleenMax - I chose 15
4: Overdrink - False
5: Simulate or something like that - False

Apparently, it found I had no keys in my inventory, so it ate the pies accordingly. I started with 95 adventures, and after it was finished, I had 242 and around 30k spent(Most meat spent on pies). Excellent speeds on my pentium 4 computer. Keep up the good work...


Thanks,
Cody
 
Last edited:
A great script! (Sorry for the long post.)

I think I might be missing something. EatDrink (v2.4 using Mafia v13.6) tried to pull from stash to create a drink, but the pull failed. The ingredient was in the stash but I did not have enough karma to make the pull. (Yeah, I know - donate to the clan stash and this is not an issue. What if I were not in a clan?)

The session log snippet is as follows:
remove from stash: 1 fermenting powder
FAIL: shot of blackberry schnapps lev:3 gain:1.0 adv:3.0 musc:6.0 myst:6.0 moxie:6.0 price:265 own:24 pull:false make:true value:2177
Calculating drink values.
Choosing drink to consume.
Attempting to consume...
Creating a shot of blackberry schnapps in 1 seconds

repeat - over and over and over

With the following settings, I assumed that the logic would do the following:
verify that I had access to all of the ingredients (if not, try next item),
would pull what was needed,
would verify that all of the ingredients were in inventory (pull successful),
then create the item and consume it.
Contrariwise, if the pull was unsuccessful (did not really have all of the ingredients):
would calculate the value of buying the missing ingredients against buying something else to eat/drink,
and do the appropriate thing.

// If true, you will buy food to consume that is not in inventory.
setvar("eatdrink_shop", true);
boolean SHOP = to_boolean(vars["eatdrink_shop"]);

// If true, you will make food if you have all the ingredients available.
setvar("eatdrink_make", true);
boolean MAKE = to_boolean(vars["eatdrink_make"]);

I can see five approaches:
set make to false
(easiest but not most cost effective)
donate to a clan
(lower middle - manually decide what to donate to get right karma level)
add a check for successful pull
(complicated - one chance or try next item - maybe like checking for all ingredients)
donate to a clan
(more complicated - automagically decide what to donate to get right karma level)
Decide whether to buy ingredients or move on
(most complicated - is it better to buy ingredient and make or buy something else)

CLI scripting I get. ASH I am still trying to understand. I guess that comes from programming in assembler instead of higher level languages -

Like BASIC.:rolleyes:
 
Last edited:
I have no idea what code in there would possibly pull from clan stash. I wonder if it's an untended consequence of an ASH acquire (or derivative) function? It was not designed to consider the clan stash at all.
 
Okay, bug report here.
I have over 1004 twinkly wads in my inventory, but the script wants to consume hot wads instead (which have to be bought).

I've added my session log.
Code:
Simulating only; no purchases or food/drink/spleen consumption.
food: At 0, consuming to 15.
0: milk of magnesium price: 845 value: 23905
1: Knob sausage chow mein lev:7 gain:5.0 adv:25.0 musc:74.0 myst:0.0 mox:0.0 meat:4200 own:0 value:4308
2: Knob sausage chow mein lev:7 gain:5.0 adv:25.0 musc:74.0 myst:0.0 mox:0.0 meat:4200 own:0 value:5108
3: Knob sausage chow mein lev:7 gain:5.0 adv:25.0 musc:74.0 myst:0.0 mox:0.0 meat:4200 own:0 value:5108
drink: At 0, consuming to 19.
1: grogtini lev:6 gain:6.0 adv:24.0 musc:18.0 myst:0.0 mox:0.0 meat:2118 own:0 value:4343
2: grogtini lev:6 gain:6.0 adv:24.0 musc:18.0 myst:0.0 mox:0.0 meat:2118 own:0 value:4343
3: grogtini lev:6 gain:6.0 adv:24.0 musc:18.0 myst:0.0 mox:0.0 meat:2118 own:0 value:4343
4: cup of primitive beer lev:12 gain:1.0 adv:3.5 musc:57.5 myst:0.0 mox:0.0 meat:990 own:0 value:4085
spleen: At 0, consuming to 15.
1: hot wad lev:6 gain:1.0 adv:1.0 musc:27.0 myst:9.0 mox:18.0 meat:405 own:0 value:919
2: hot wad lev:6 gain:1.0 adv:1.0 musc:27.0 myst:9.0 mox:18.0 meat:405 own:0 value:919
3: hot wad lev:6 gain:1.0 adv:1.0 musc:27.0 myst:9.0 mox:18.0 meat:405 own:0 value:919
4: hot wad lev:6 gain:1.0 adv:1.0 musc:27.0 myst:9.0 mox:18.0 meat:405 own:0 value:919
5: hot wad lev:6 gain:1.0 adv:1.0 musc:27.0 myst:9.0 mox:18.0 meat:405 own:0 value:919
6: hot wad lev:6 gain:1.0 adv:1.0 musc:27.0 myst:9.0 mox:18.0 meat:405 own:0 value:919
7: hot wad lev:6 gain:1.0 adv:1.0 musc:27.0 myst:9.0 mox:18.0 meat:405 own:0 value:919
8: hot wad lev:6 gain:1.0 adv:1.0 musc:27.0 myst:9.0 mox:18.0 meat:405 own:0 value:919
9: hot wad lev:6 gain:1.0 adv:1.0 musc:27.0 myst:9.0 mox:18.0 meat:405 own:0 value:919
10: hot wad lev:6 gain:1.0 adv:1.0 musc:27.0 myst:9.0 mox:18.0 meat:405 own:0 value:919
11: hot wad lev:6 gain:1.0 adv:1.0 musc:27.0 myst:9.0 mox:18.0 meat:405 own:0 value:919
12: hot wad lev:6 gain:1.0 adv:1.0 musc:27.0 myst:9.0 mox:18.0 meat:405 own:0 value:919
13: hot wad lev:6 gain:1.0 adv:1.0 musc:27.0 myst:9.0 mox:18.0 meat:405 own:0 value:919
14: hot wad lev:6 gain:1.0 adv:1.0 musc:27.0 myst:9.0 mox:18.0 meat:405 own:0 value:919
15: hot wad lev:6 gain:1.0 adv:1.0 musc:27.0 myst:9.0 mox:18.0 meat:405 own:0 value:919
 

Attachments

Hot wads have better muscle gains than twinkly wads do. Your configuration is based on muscle being valued at a weight of 10 and substats weighted at only 2. Hot wads fall under your per item budget. I believe the script did what it was programmed to do. If you were expecting twinkly wads, perhaps you need to tweak your adventure value and/or stat weights? I've only simmed the script myself and hesitate to run it live because there is no total budget and I'd like to say spend up to x amount per item, but don't spend more than y total. The only way I can accomplish that seems to be messing with the adventure cost.
 
I have no idea what code in there would possibly pull from clan stash. I wonder if it's an untended consequence of an ASH acquire (or derivative) function? It was not designed to consider the clan stash at all.

I found it - I think. Someone knowing the inner workings of Mafia will need to chime in.

Under the General Preferences, there are options to
"Buy items from NPC stores whenever needed", (not checked)
"Buy items from the mall whenever needed", (not checked)
and "Take items from the clan stash whenever needed". (checked):eek:

So the question is, how do the Mafia Preferences effect the logic and performance of the ASH script?
 
Last edited:
While calling eatdrink from a script I saw something that I can't figure out. I called eatdrink with the following code:

Code:
cli_execute("zlib eatdrink_budget = 5000");
eatdrink(fullness_limit(),inebriety_limit(),spleen_limit(),true,50,25,5,1000,false);
Here's the cli output:
Previous value of eatdrink_budget: 20000
Changed to 5000.
Checking for updates (running EatDrink ver. 2.4)...
_version_eatdrink => 2.4
Refreshing stash contents...
Stash list retrieved.
Internal checkpoint created.
Starting EatDrink.ash (version 2.4).
Consuming up to -3 food, 0 booze, and 20 spleen
Considering food from inventory Hagnk's . Per-item budget cap is 25000.0.

It didn't take into account the change in the budget from 20k to 5k? I checked the vars.txt and the variable was properly set to 5000.
 
Asturia - it sounds like you don't want the script to consider the cost of items you have in inventory. If so, there's a flag setting just for that. Otherwise, eatdrink gave you exactly what you asked for - the optimal spleenable given the values you attached to adventures and stats, and the current mall cost.
 
It's optional. If you see the script about to do something you don't like you can interrupt it. Just change the setting to 0 to avoid.
 
First - thanks for this great script!

I was a little confused by some of its choices, until I realised that it has different values of average adventures to the wiki - in this example the wiki says pr0n chow mein has 19.5 average and olive lo mein 12.5.

Which is correct?

----------------------------
Attempting to consume...
Knob sausage chow mein lev:7 gain:5.0 adv:25.0 musc:74.0 myst:0.0 moxie:0.0 price:4250 own:0 pull:false make:false value:4150
simulating consumption of one Knob sausage chow mein.
0: milk of magnesium price: 855 value: 23895
1: Knob sausage chow mein lev:7 gain:5.0 adv:25.0 musc:74.0 myst:0.0 moxie:0.0 price:4250 own:0 pull:false make:false value:4150
Choosing food to consume.
If there are any favorites still in consideration, they'll be listed here:
Hell ramen lev:6 gain:6.0 adv:25.0 musc:25.0 myst:25.0 moxie:25.0 price:3195 own:0 pull:false make:false value:3634
olive lo mein lev:6 gain:3.0 adv:12.0 musc:12.0 myst:0.0 moxie:12.0 price:1400 own:1 pull:false make:false value:3534
pr0n chow mein lev:7 gain:4.0 adv:19.0 musc:23.0 myst:0.0 moxie:23.0 price:3365 own:3 pull:false make:false value:3909
 
As of late eatdrink has been breaking/looping during spleen consumption about every other use. I normally just abort and then run it again and all is well, but every time I run it right now it just loops during spleening. The cli repeats this:

Starting EatDrink.ash (version 2.4).
Consuming up to 12 food, 19 booze, and 15 spleen
Considering food from the mall. Per-item budget cap is 6250.0.
Price will be a factor if you own it already. Hagnk's pulls (if enabled) will cost 1000 meat each.
An adventure has the value of 50 meat. Moxie subpoint is 25.0. Nonprime stat subpoint is 5.0.
spleen: At 2, consuming to 15.
(usable quantity of blue polka-dot oyster egg is limited to 0 by needed restoration or spleen)
FAIL: blue polka-dot oyster egg lev:1 gain:1.0 adv:0.0 musc:0.0 myst:0.0 mox:13.0 meat:100 own:0 value:30
(usable quantity of blue polka-dot oyster egg is limited to 0 by needed restoration or spleen)
FAIL: blue polka-dot oyster egg lev:1 gain:1.0 adv:0.0 musc:0.0 myst:0.0 mox:13.0 meat:100 own:0 value:30
(usable quantity of blue polka-dot oyster egg is limited to 0 by needed restoration or spleen)
FAIL: blue polka-dot oyster egg lev:1 gain:1.0 adv:0.0 musc:0.0 myst:0.0 mox:13.0 meat:100 own:0 value:30

I opened eatdrink up in an editor to check things out, but I couldn't figure out why the spleening section keeps breaking? This is on a level 11 character. If I remember correctly when it goes into an infinite loop it's usually trying to get one of the various oyster eggs. I don't know if that's relevant, but I'll start keeping better documentation when it loops to shed more light on the situation. As for now though, I can't even use it because of it going into the aforementioned loop every time I run it.
 
If you look at the page for pr0n chow mein, it says 16-23 - which is the range KoLmafia uses, too, since it is right from the Well-Tempered Epicure. That is an average of 19.5 adventures per 4-fullness dish.
 
Error in the wiki - if you look at the page I linked to, it's 16-24. It's not editable, though, so I can't fix it on the wiki. I'll take a look at the code.
 
Back
Top