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

Hey, I've tried to run this a couple of times and I keep getting the following:

Undefined reference to function 'report_price' (getonbudget.ash, line 36)

Anyone else have this problem?
 
New test version! If you download and try it, please post your results here so I know if I should update the main version.

Just two improvements: It plays nice with zlib (and also ascend.ash), and it's much much much faster.

Please let me know if it works. If you think it chose the wrong diet for you, please post the complete output here so I can try to debug.

Oh: you MUST DELETE YOUR OLD DATA FILES and replace them with the attached 3 data files.
 

Attachments

Last edited:
Total WTF here. The updated version here on the last page seems to have suddenly decided it wants to drink food.

Starting EatDrink.ash (version 2.1).
Consuming up to 13 food, 19 booze, and 15 spleen
Considering food from inventory Hagnk's the mall. Per-item budget cap is 25000.0.
Price will be a factor if you own it already. Hagnk's pulls (if enabled) will cost 3000 meat each.
An adventure has the value of 900 meat. Muscle subpoint is 0. Nonprime stat subpoint is 0.
Loading drink records.
Now at inebriety of 0, drinking to 19.
Updating drink map with Mafia's datafiles (slow, happens once per week)
Filtering remaining drinks for level and availability.
Calculating drink values.
Choosing drink to consume.
Attempting to consume...
Shopping for a spooky lo mein in 3 seconds
Countdown: 3 seconds...
Countdown: 2 seconds...
Countdown: 1 second...
Waiting completed.
budgeting 1993 for 1 additional spooky lo mein. You have 9681288 meat. You have 0 in inventory already.
You have more meat than budgeted, so putting the excess 9679295 meat in closet.
Placing meat into closet...
Searching for "spooky lo mein"...
Purchasing spooky lo mein (1 @ 1,595)...
You acquire an item: spooky lo mein
Purchases complete.
Removing meat from closet...
Purchased 1 spooky lo mein for 1595 meat.
spooky lo mein is not an alcoholic beverage.
FAIL: spooky lo mein lev:6 gain:4.0 adv:18.0 musc:0.0 myst:0.0 moxie:33.0 price:1595 own:0 pull:false make:false value:3652
Calculating drink values.
Choosing drink to consume.
Attempting to consume...
You have at least one spooky lo mein in inventory.
Countdown: 3 seconds...

Edit: It appears that somehow both my drink and spleen data files have food items in them as well. Perhaps the new version is corrupting them?
 
Last edited:
So you're saying you *don't* want to drink food?

Sigh. Fine.

The previous post is updated so it gets drinks from the drink file and spleenables from the spleen file. Be sure to nuke your datafiles and re-download them as they've been "updated" in a way you seem not to prefer. Keep the bug reports coming.

:)
 
This version seems to want to make TPS drinks on my non-TPS alt, perhaps caused by being first run on my TPS bearing main. Luckily it figures it out and fails pretty quickly.
 
I love the script. Some questions though.

Why does it only purchase things one at a time? If it is going to buy 5 of something, can it budget for 5 appropriately and buy them all at the same time if they are at the budgeted (same) price? Similarly, if you have a number of items in inventory, can it calculate the number needed and consume them all at once?
 
Last edited:
It only purchases one at a time because that way, if it costs more than anticipated (each successive purchase might be priced higher in the mall) the script can catch the error and adjust its expectations of pricing by purchasing a less expensive item.

tl;dr: Because dj_d is clever and wants to outsmart mafia's limited pricing info.
 
Righto. And it's not hypothetical; it happens quite a bit - someone makes a small number of something available at price X, and when you go to buy it, it's unavailable or there's not a sufficient quantity available at the price you asked for.

Incidentally, an update that uses historical_prices is in the todo list.
 
Righto. And it's not hypothetical; it happens quite a bit - someone makes a small number of something available at price X, and when you go to buy it, it's unavailable or there's not a sufficient quantity available at the price you asked for.

By unavailable, I take that as the seller has limited the number that you can buy in a day, or if using historic prices that no one is selling at that price.

It seems like you could find out the lowest price and buy up to X number at that price. If the price was more than the expected, recalculate like you do now.

Alternatively, you could say while there are X remaining to purchase and since the cost of the last one was Y (found from buying the first or some other method), keep buying at price Y until there were no more at that price or you purchased enough of them. You would have to budget more when you went to buy, but that can be limited to Y*X.

That is unless there is something in the Mafia purchasing mechanics that I do not understand. Maybe I am trying to force a script to do things the way I would do it in a browser (chrome BTW).

tg
 
That is unless there is something in the Mafia purchasing mechanics that I do not understand.
This.

Purchasing in mafia is like juggling in a strait jacket. It will tell you the price of the 5th item available for purchase rather than the current one, it will not tell you anything else about prices or quantities, and it will only check once per session. If someone purchases those items while you are continuing to compute the best choice, you cannot simply check the price again to ensure it hasn't changed. A lot can happen around mafia's limitations so dj_d is trying to save your ass.
 
Although I confess to having noodled on ways that I could use my scripts for nefarious purposes. If you ever find yourself filling up on grimacite bocks from dj_d's store, you'll know that I've gone to the dark side. ;)

On a happier note, a WAY faster eatdrink that uses historical prices! The data files from the earlier post should be compatible. Please post feedback!

Ed: You must use the data files from post #103: http://kolmafia.us/showpost.php?p=15665&postcount=103
 

Attachments

Last edited:
sorry to bring bad news, something came up with the new version

Simulating only; no purchases or food/drink/spleen consumption.
Loading food records.
Now at fullness of 0, eating to 30.
Unexpected error, debug log printed.
Error loading eatdrink_food_data.txt, aborting

there's something up with the old data files that the new version isn't having a good time with
 
Last edited:
On a happier note, a WAY faster eatdrink that uses historical prices! The data files from the earlier post should be compatible.
I'll look forward to testing this out.

You should update that first post. I assume getonbudget.ash, price.ash and pricelist.txt are no longer necessary?
 
I'll update the first post as soon as I hear from a few folks that this version is stable and working from them. And yes - they're gone!
 
I got this:
Simulating only; no purchases or food/drink/spleen consumption.
Loading food records.
Now at fullness of 0, eating to 30.
Unexpected error, debug log printed.
Error loading eatdrink_food_data.txt, aborting

I tried it with eatdrink_food_data.txt in the actual scripts folder and I tried it with it in the data folder, but it failed to load from both places.
 
This.

Purchasing in mafia is like juggling in a strait jacket. It will tell you the price of the 5th item available for purchase rather than the current one, it will not tell you anything else about prices or quantities, and it will only check once per session. If someone purchases those items while you are continuing to compute the best choice, you cannot simply check the price again to ensure it hasn't changed. A lot can happen around mafia's limitations so dj_d is trying to save your ass.

That definitely changes the thought process. Thanks dj_d for saving us all! Thanks Bale for the enlightenment!
 
Back
Top