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

First try to implement the shotglass

I have made a couple of changes to the script to handle the shotglass. It seems to work well for me but use it at your own risk. The main function should be fine, I'm just afraid I haven't think the overloader correctly for all the scripts.

It will warn you if you input true for the shotglass but can't use it ( don't have it or used it already ). It will simply skip it, it will not abort. It's not a bug it's a feature ;)

Main() will now ask for a boolean for shotglass so if you try to use it from another script it is now eatdrink(int foodMax, int drinkMax, int spleenMax, boolean overdrink, boolean shotglass, boolean sim) or if you want to skip simulation use eatdrinkdo(int foodMax, int drinkMax, int spleenMax, boolean overdrink, boolean shotglass).

Please note that I have renamed the main eatdrink function to eatdrinkdo to prevent a conflict between (int foodMax, int drinkMax, int spleenMax, boolean overdrink, boolean shotglass) and (int foodMax, int drinkMax, int spleenMax, boolean overdrink, boolean sim).

I also tried to make an overloader for the old eatdrink ( int, int, int, boolean ), it will assume that if you are maxing your liver, you might as well try the shotglass. Maybe do the shotglass even if you don't max it out? I'm open to suggestions but this should prevent harvest from hanging.

--Grab

P.S. I'm not sure what "int EATDRINK_VERSION_PAGE = 1519;" does but I named this version 3.3 ?\_(ツ)_/?

View attachment EatDrink.ash
 
P.S. I'm not sure what "int EATDRINK_VERSION_PAGE = 1519;" does but I named this version 3.3 ?\_(ツ)_/?

In the days before SVN a script author could use zlib functions to check for versions. Basically the function went to the first post in a thread on kolmafia,us and looked for a version number on that page. If the version number of the script being run and the version on the page were different then the user would be told there was an update available and directed to that page to get the update. So you did the right thing to support the legacy version checking, except that the updated version is no longer attached to the first page. But that is what EATDRINK_VERSION_PAGE = 1519 is used for.

I will note that I don't use Harvest and this fixes what I consider a logic error in Harvest at the cost of making me enter one more parameter when running manually and having to check all the places I call eatdrink from a script. I probably won't adopt it ;-)
 
It isn't just a Harvest error. From what I can tell from the script, that means you are either not using size 1 item and don't see that you aren't using the shotglass, or you are using the shotglass and end up short on your drinking and have to run the script again. Also that is the idea for the overloader. It should, at least if your script calls for inebriety_limit(), works just like usual.
 
Last edited:
Past few days I've been getting this error whenever the script tries to purchase items for consumption


Starting EatDrink.ash (version 3.2).
Consuming up to 15 food, 20 booze, and 15 spleen
Considering food from inventory Hagnk's Coinmasters NPCs the mall. Per-item budget cap is 75000.0.
Retrieval cap is 1000. Price will be a factor if you own it already.
An adventure has the value of 3000 meat. Muscle subpoint is 0.0. Nonprime stat subpoint is 0.0.
Pass 1: booze.
booze: At 0, consuming to 20 with 2502350 meat.
Getting 6 perfect mimosa in 1 seconds
Countdown: 1 second...
Waiting completed.
autoBuyPriceLimit => 1250.0
Searching for "boxed wine"...
Search complete.
Searching for "fermenting powder"...
Search complete.
Searching for "bunch of square grapes"...
Search complete.
Searching for "perfect mimosa"...
Search complete.
Searching for "perfect ice cube"...
Search complete.
Using cached search results for perfect mimosa...
Desired purchase quantity not reached (wanted 6, got 0)
Using cached search results for perfect mimosa...
Desired purchase quantity not reached (wanted 6, got 0)
You need 6 more perfect mimosa to continue.
autoBuyPriceLimit => 1000
Something went wrong with getting perfect mimosa for 3111. Recalculating.

Getting 1 chocolate turtle totem in 1 seconds
Countdown: 1 second...
Waiting completed.
autoBuyPriceLimit => 1250.0
Searching for "chocolate turtle totem"...
Search complete.
Desired purchase quantity not reached (wanted 1, got 0)
Using cached search results for chocolate turtle totem...
Desired purchase quantity not reached (wanted 1, got 0)
You need 1 more chocolate turtle totem to continue.

Has anyone encountered this issue?

My current manual workaround to stop the script and purchase it manually and re-run the script.
 
Past few days I've been getting this error whenever the script tries to purchase items for consumption...
Has anyone encountered this issue?...
My current manual workaround to stop the script and purchase it manually and re-run the script.

From what i can see, the items costs exceeded the autoBuyPriceLimit.
 
Change the autoBuyPrice limit?

Would you be able to guide me through how to amend the .ash script to make the necessary changes?

It's strange how it only occurs for those booze drinks such as perfect cosmopolitan, perfect dark and stormy (basically those drinks that include the perfect cube).
 
Last edited:
It's a KoLmafia property.

Run mafia, open the gCLI, and type 'set autoBuyPriceLimit xxxxx' where xxxxx is the most meat you want to allow KoLmafia to spend on one item automatically.

See http://wiki.kolmafia.us/index.php?title=KoLmafia_Properties for a somewhat incomplete and out of date list of Kolmafia properties.

See http://wiki.kolmafia.us/index.php?title=CLI_Reference for the commands the command line understands.

Wow! You're a life saviour, it worked perfectly and also resolved why I sometimes get a similar error when I tried running "acquire XXX". Thanks so much!

I had no idea kolmafia had those properties, I was actually searching around the preferences for something along those lines but could not find it
 
Wow! You're a life saviour, it worked perfectly and also resolved why I sometimes get a similar error when I tried running "acquire XXX". Thanks so much!

I had no idea kolmafia had those properties, I was actually searching around the preferences for something along those lines but could not find it

You're welcome. Apologies if I came across as a bit snarky.
 
If you're inclined to go one step further, you can open settings/<playername>_settings.txt in your favorite text editor (on windows, that'll probably default to notepad, which is a terrible option, but "good enough") to manually edit the preferences file when Mafia isn't running. No guarantees about what editing that file when Mafia is running will do.
 
Yeah, at some point I should add a preference for shotglass. If it's set, you have a shotglass, and haven't used it yet, do a size-1 drink cycle and then do your full-size after that.

And the hint that it was aBPL as your problem was this in your log:
Retrieval cap is 1000. Price will be a factor if you own it already.
Whatever shows as retrieval cap is your aBPL. Doesn't look like it's displayed anywhere in the GUI anymore, but I could have sworn it was there a while ago. Oh well.
 
Recently, and I'm not sure whether that is a couple of weeks or a couple of months, I noticed that ED does not fill my spleen up on the first pass.

I run it allowing it to go for Max Spleen but it stops before it is full. I immediately run it again and it finds a spleen item and consumes it. I run it again, it finds something (occasionally the previously consumed item but usually something different) and after the third or fourth run the spleen is full.

The only things I can think of that change between runs are starting fullness, mall prices and how much has been spent during the EatDrink run.

I don't recall this happening "a while ago" so I wonder if there is something hardwired that the new spleen items effected? It might be meat related since I don't recall seeing it with a VOA of 2500 but it is happening with a VOA of 2000 and lower. But if it is related to spending then why isn't the second run sufficient?

I suppose I could look at the script but it is much more fun to ask.

Thanks.
 
Pass 3: spleen.
spleen: At 0, consuming to 15 with 10000 meat.
No spleen available that's good enough. Found 1 items first. Moving on.

I paid closer attention today.

Immediately after that it consumed an Unconscious Collective Dream Jar for 9,000 meat and stopped. I noted a variable eatdrink_StepMeat set to 10000, cleared it and I'm full again.
 
There seems to be some issues with new consumables which can only be consumed by vampires? I haven't played the new path, so not 100% sure about this, but I guess that is the issue? Output to the cli is:

Code:
        [COLOR=olive]> eatdrink[/COLOR]

Refreshing stash      contents...
Stash list retrieved.
Internal checkpoint created.
[COLOR=black]Skipping      favorites.[/COLOR]
Starting EatDrink.ash (version 3.2).
Consuming up      to 20 food, 0 booze, and 15 spleen
Considering food from inventory      Hagnk's NPCs the mall. Per-item budget cap is 125000.0.
Retrieval cap      is 30000. Price will be a factor if you own it already.
An adventure      has the value of [B]2500 meat[/B]. Mysticality subpoint is 0.0. Nonprime      stat subpoint is 0.0.
[COLOR=black]Pass 1: booze.[/COLOR]
[COLOR=black]Skipping      booze.[/COLOR]
[COLOR=black]Pass 2: food.[/COLOR]
food: At 0,      consuming to 20 with 589540006 meat.
[COLOR=black]Waiting to      consume...[/COLOR]
<b>blood-soaked sponge cake</b> lev:1 gain:1.0      adv:23.0 musc:27.5 myst:27.5 mox:27.5 meat:27500 own:1 value:30000
Countdown:      1 second...
Waiting completed.
(usable quantity of blood-soaked      sponge cake is limited to 0 by remaining fullness)
FAIL:      <b>blood-soaked sponge cake</b> lev:1 gain:1.0 adv:23.0 musc:27.5      myst:27.5 mox:27.5 meat:27500 own:1 value:30000
[COLOR=black]Waiting      to consume...[/COLOR]
<b>blood-soaked sponge cake</b> lev:1 gain:1.0      adv:23.0 musc:27.5 myst:27.5 mox:27.5 meat:27500 own:1 value:30000
Countdown:      1 second...
[COLOR=red]KoLmafia declares world peace.[/COLOR]

Is there some setting I can adjust to make it ignore certain consumables? I tried "> set eatdrink_avoid_blood-soaked_sponge_cake=true" but it doesn't seem to work. Have I forgotten something about how script variables are set this day, or have I misunderstood what these variables are for?
 
Last edited:
Back
Top