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

lostcalpolydude

Developer
Staff member
can_interact() - returns true if you have access to the mall.

1200 turns into a softcore run at level 11 you have mall access, but haven't gotten past the point where you need the keys. You could load ascend.php (another server hit) and see if anything loads. That's technically a check for having freed the king, and I don't know what the response is if you haven't freed the king.
 

Bale

Minion
Possibly the best way is...
PHP:
if(!can_interact() || my_level() < 13 || !contains_text(visit_url("lair2.php"), "cave22done.gif"))
   need_pies = true;
That won't bother with a server hit unless you have mall access and are level 13. Also, it will tell you if you've cleared the entry to the lair, even if you haven't managed to defeat Her Naughtiness yet. After all, you no longer need keys at that point.
 

adeyke

Member
I know it's much to ask, but I'd love it if this script had sea support. To first approximation, this would mean giving half of the normal weight to adventure gains, while also giving that much weight to an adventure of Fishy. And it would require support for rolling sushi The script is already immensely useful for land-based adventuring, but if some future version had that feature as well, it would be even better :).
 

kain

Member
I appear to have run out of ice cold foties while drinking ...

Code:
Refreshing stash contents...
Stash list retrieved.
Internal checkpoint created.
Loading favorite consumables from user settings...
adding favorite: rockin' wagon
adding favorite: pr0n chow mein
adding favorite: twinkly wad
You're in ronin, and not simulating, so no shopping for you.
Starting EatDrink.ash (version 3.0).
Consuming up to 15 food, 19 booze, and 15 spleen
Considering food from inventory Hagnk's . Per-item budget cap is 25000.0.
Price will be a factor if you own it already. Hagnk's pulls (if enabled) will cost 4000 meat each.
An adventure has the value of 1600 meat. Moxie subpoint is 5.0. Nonprime stat subpoint is 1.0. Hagnk pulls are limited and their 'cost' is incorporated.
Already updated from http://zachbardon.com/mafiatools/updateprices.php?action=getmap in this session.
Already updated from http://nixietube.info/mallprices.txt in this session.
Pass 1: food.
Skipping food.
Pass 2: drink.
drink: At 1, consuming to 19.
Loading drink map from Mafia's datafiles
dusty bottle of Merlot:
dusty bottle of Port:
dusty bottle of Pinot Noir:
dusty bottle of Zinfandel:
dusty bottle of Marsala:
dusty bottle of Muscat:
dusty bottle of Merlot:
dusty bottle of Port:
dusty bottle of Pinot Noir:
dusty bottle of Zinfandel:
dusty bottle of Marsala:
dusty bottle of Muscat:
dusty bottle of Merlot:
dusty bottle of Port:
dusty bottle of Pinot Noir:
dusty bottle of Zinfandel:
dusty bottle of Marsala:
dusty bottle of Muscat:
dusty bottle of Merlot:
dusty bottle of Port:
dusty bottle of Pinot Noir:
dusty bottle of Zinfandel:
dusty bottle of Marsala:
dusty bottle of Muscat:
dusty bottle of Merlot:
dusty bottle of Port:
dusty bottle of Pinot Noir:
dusty bottle of Zinfandel:
dusty bottle of Marsala:
dusty bottle of Muscat:
dusty bottle of Merlot:
dusty bottle of Port:
dusty bottle of Pinot Noir:
dusty bottle of Zinfandel:
dusty bottle of Marsala:
dusty bottle of Muscat:
Filtering by type
Filtering by level
Finding prices
Favorite rockin' wagon appears unavailable given budget, SHOP variable settings, ronin status, and/or mall price.
Setting values
Choosing drink to consume.
Waiting to consume...
ice-cold fotie lev:1 gain:3.0 adv:3.0 musc:0.0 myst:0.0 mox:0.0 meat:100 own:4 value:1566
Countdown: 3 seconds...
Countdown: 2 seconds...
Countdown: 1 second...
Waiting completed.
You have at least one ice-cold fotie in inventory.
Countdown: 3 seconds...
Countdown: 2 seconds...
Countdown: 1 second...
Waiting completed.
Drinking 1 ice-cold fotie...
You gain 3 Adventures
You gain 10 Mojo Points
You gain 3 Drunkenness
Finished drinking 1 ice-cold fotie.
1: ice-cold fotie lev:1 gain:3.0 adv:3.0 musc:0.0 myst:0.0 mox:0.0 meat:100 own:4 value:1566
Choosing drink to consume.
Waiting to consume...
ice-cold fotie lev:1 gain:3.0 adv:3.0 musc:0.0 myst:0.0 mox:0.0 meat:100 own:4 value:1566
Countdown: 3 seconds...
Countdown: 2 seconds...
Countdown: 1 second...
Waiting completed.
You have at least one ice-cold fotie in inventory.
Countdown: 3 seconds...
Countdown: 2 seconds...
Countdown: 1 second...
Waiting completed.
Drinking 1 ice-cold fotie...
You gain 3 Adventures
You gain 11 Mojo Points
You gain 3 Drunkenness
Finished drinking 1 ice-cold fotie.
2: ice-cold fotie lev:1 gain:3.0 adv:3.0 musc:0.0 myst:0.0 mox:0.0 meat:100 own:4 value:1566
Choosing drink to consume.
Waiting to consume...
ice-cold fotie lev:1 gain:3.0 adv:3.0 musc:0.0 myst:0.0 mox:0.0 meat:100 own:4 value:1566
Countdown: 3 seconds...
Countdown: 2 seconds...
Countdown: 1 second...
Waiting completed.
You have at least one ice-cold fotie in inventory.
Countdown: 3 seconds...
Countdown: 2 seconds...
Countdown: 1 second...
Waiting completed.
Drinking 1 ice-cold fotie...
You gain 3 Adventures
You gain 9 Mojo Points
You gain 3 Drunkenness
Finished drinking 1 ice-cold fotie.
3: ice-cold fotie lev:1 gain:3.0 adv:3.0 musc:0.0 myst:0.0 mox:0.0 meat:100 own:4 value:1566
Choosing drink to consume.
Waiting to consume...
ice-cold fotie lev:1 gain:3.0 adv:3.0 musc:0.0 myst:0.0 mox:0.0 meat:100 own:4 value:1566
Countdown: 3 seconds...
Countdown: 2 seconds...
Countdown: 1 second...
Waiting completed.
You have at least one ice-cold fotie in inventory.
Countdown: 3 seconds...
Countdown: 2 seconds...
Countdown: 1 second...
Waiting completed.
Drinking 1 ice-cold fotie...
You gain 3 Adventures
You gain 10 Mojo Points
You gain 3 Drunkenness
Finished drinking 1 ice-cold fotie.
4: ice-cold fotie lev:1 gain:3.0 adv:3.0 musc:0.0 myst:0.0 mox:0.0 meat:100 own:4 value:1566
Choosing drink to consume.
Waiting to consume...
ice-cold fotie lev:1 gain:3.0 adv:3.0 musc:0.0 myst:0.0 mox:0.0 meat:100 own:4 value:1566
Countdown: 3 seconds...
Countdown: 2 seconds...
Countdown: 1 second...
Waiting completed.
EatDrink encountered an error: You don't have a ice-cold fotie and you're not able to shop.
record con_rec price updated from 0 to 0.
invalid type! ''

I had this problem with sneaky pete's key lime pie and cherry pies, too.
 

illarion

Member
The script seems to be getting stuck for me. This has been happening for a few days, across a couple of characters. I believe it's always thistle wine that's the problem:

Countdown: 1 second...
Waiting completed.
Shopping for a thistle wine in 3 seconds
Countdown: 3 seconds...
Countdown: 2 seconds...
Countdown: 1 second...
Waiting completed.
budgeting 450 for 1 additional thistle wine. You have 8703029 meat. You have 0
in inventory already.
Searching for "thistle wine"...
Stopped purchasing thistle wine @ 475.
Purchased 0 thistle wine for 0 meat.
Tried to get 1 thistle wine but got 0. Pricing error.
Seen a problem with this one before at a price of 2805.
Setting new effective price to the greater of 450 and 2807
Failed to get thistle wine for a max price of 1.25*360=450.0
FAIL: <b>thistle wine</b> lev:10 gain:1.0 adv:3.0 musc:0.0 myst:0.0 mox:45.0 mea
t:360 own:0 value:3090
Choosing drink to consume.
Waiting to consume...
<b>thistle wine</b> lev:10 gain:1.0 adv:3.0 musc:0.0 myst:0.0 mox:45.0 meat:360
own:0 value:3090
Countdown: 3 seconds...
Countdown: 2 seconds...

...and it just keeps repeating doing that, ad nauseum.
 

illarion

Member
Thanks for the response. However...

1 - I haven't upgraded to the latest dailies yet (heard about the problems in time) - I'm still using 7845. And the problem described there doesn't look the same as mine (it's an actual debug log error, wheras mine I think is a logic error in the script).
2 - The EatDrink version linked there is 3.0, which is what I have - unless it includes changes without upping version, it won't make a difference.

Still, I'll give it a try.
 

dj_d

Member
Charles/Bale, thanks! Attached.

Adeyke, I sketched the outline of such a thing, but I don't think it's coming soon. Sorry. :)

Illarion, you're seeing a bug I've been attempting to quash in posts here in the update thread. Try the most recent one of those. Like this one!
 

Attachments

  • EatDrink.ash
    57.3 KB · Views: 83
Last edited:
Using the latest build (7875 at time of writing) and the script version 3.0 from the front page I got this:

> call scripts\EatDrink.ash

[the ode to booze] does not match anything in the status effect database.
Bad effect value: "the ode to booze" (EatDrink.ash, line 1339)

I proceeded to upgrade the script with the one in the previous post, and this time it worked, but simulated consumption is *way* slower than it was. Is there any way to speed it up back to what it was?
 

dj_d

Member
There weren't any changes that should affect simulated consumption - just the ode fix and a few cosmetic details.
 

Bazaaretw

Member
I noticed after the ode fix and with the newest build, when I run farm.ash when it runs eat/drink it consumes the most expensive things within reason, but when I run it by it's self, it does it by the peramiters, I was under the impression that with farm.ash it would budget the diet accordingly.
 
I'm getting the same slowness described by Italian Hippie. KoLmafia 7876, eatdrink from post 350. It seems to slow up when "Setting values". I'm also running simulation.
 

dj_d

Member
aqua - can you try it, then abort, then try an older version? I strongly doubt that the change I made had any effect but I guess it's possible.

Bazaare - I think farm.ash specifies its own parameters.
 
Here's my testing:

r7878, EatDrink from #350 : slows at "Setting values"
r7859 (before parsing changes), EatDrink from #350 : slows at "Setting values"

r7878, EatDrink from #339 : "the ode to booze" error
r7878, EatDrink from #339 with "the " deleted from line 1406: no slowdown
r7859, EatDrink from #339 : no slowdown

r7878, EatDrink 3.0 : "the ode to booze" error
r7878, EatDrink 3.0 with "the " deleted from line 1339 : no slowdown
r7859, EatDrink 3.0 : no slowdown

In all cases, tested with 1 / 1 / 1 / true / true; characters had not used any stomach/liver/spleen yet today. (I've seen the slowdown happen with other settings and situations too, though.)

Looks like whatever you did between the version posted in post #339 and the version in #350 is causing slowdowns at least for me and Italian Hippie.
 

dj_d

Member
I diff'd the two builds, and - never say never, but, uh, I don't think there's any meaningful difference.
- removed "the" from "the ode to booze"
- Added the logic Bale suggested to the pie determination logic
- Fixed a fail-to-consume error message to grub[to_consume].it, so it printed correctly

That's it.
 

dj_d

Member
ed: as I was saying, never say never. Bale's fix was not intended to be run inside a loop that evaluates every item in the game. :) Post #350 now has a fixed version.
 
Edit: I'm glad you figured it out too!

Well, my guess is that Bale's logic may be the heart of the problem:
"Setting values" is the display at the slowdown point
Search for "Setting values" in the code, right there is a loop which calls value()
value() always calls special_values()
if PIE_PRIORITY, can_interact(), and my_level() >= 13 are true, special_values():
1) hits the server
2) does a contains_text on that page

That can add up to quite a lot of server hitting and page parsing, yes? I'm betting that Italian Hippie and I are having this problem because we have all those other conditions true. If you have a character with all these conditions true, I bet you can get the slowdown too.

Also related to that server hit, I can confirm that it's a problem for high-level unascended characters (and presumably those in casual):
Server www.kingdomofloathing.com returned a blank page from lair2.php. Complain to Jick, not us.
 
Last edited:
Top