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

It seems this is only going to look at Hagnk's if the user sets the appropriate option AND they are not in ronin. I feel like this should be OR instead but I'm not sure I fully understand what the script is doing to be certain. Can you clarify what I am missing, please?

Considering that there is an 'if (get_ronin())' inside that block, which would always return false with the given outer condition ... it's probably not entirely correct.
 
It's the part where we removed auto-pulling while in ronin as an official feature a while ago. Yes, we could remove the second logic check, but it makes it REALLY easy for people that might want to auto-pull for drinks to switch it over. :) But it isn't changing in the official release, unless it's to make it harder to self-support by removing the second ronin check.
 
I'm not entirely if this is a bug with eatdrink or with mafia's acquisition code (or with me being a git), but when running eatdrink as a myst class I often experience the following:
Code:
[COLOR=olive]> eatdrink (15,14,20,false,false)[/COLOR]

[COLOR=black]Checking for updates (running EatDrink ver. 3.2)...[/COLOR]
[COLOR=gray](...)
[/COLOR]Considering food from inventory closet Hagnk's Coinmasters NPCs the mall. Per-item budget cap is 125000.0.
Retrieval cap is 40000. Price will be a factor if you own it already.
An adventure has the value of [B]1000 meat[/B]. Mysticality subpoint is 0.0. Nonprime stat subpoint is 0.0.
[COLOR=black](...)
Getting 5 gnat lasagna in 1 seconds[/COLOR]
Countdown: 1 second...
Waiting completed.
autoBuyPriceLimit => 4858.0
Searching for "gnatloaf"...
Search complete.
Searching for "filet of tangy gnat ("fotelif")"...
Search complete.
Searching for "ancient spice"...
Search complete.
Searching for "gnatloaf casserole"...
Search complete.
Searching for "Gnollish casserole dish"...
Search complete.
Searching for "gnat lasagna"...
Search complete.
Searching for "dry noodles"...
Search complete.
Searching for "MSG"...
Search complete.
autoBuyPriceLimit => 40000
[COLOR=black]Something went wrong with getting gnat lasagna for 3887. Recalculating.[/COLOR]
[COLOR=black]Pass 1: food.[/COLOR]
food: At 0, consuming to 15 with 8172792 meat.
[COLOR=red]KoLmafia declares world peace.[/COLOR]
[COLOR=red]KoLmafia declares world peace.[/COLOR]
[COLOR=olive]
> buy 5 gnat lasag[/COLOR]

Using cached search results for gnat lasagna...
Purchasing gnat lasagna (5 @ 3,888)...
Purchases complete.

[COLOR=olive]> eatdrink (15,14,20,false,false)[/COLOR]
(...)
Considering food from inventory closet Hagnk's Coinmasters NPCs the mall. Per-item budget cap is 125000.0.
Retrieval cap is 40000. Price will be a factor if you own it already.
An adventure has the value of [B]1000 meat[/B]. Mysticality subpoint is 0.0. Nonprime stat subpoint is 0.0.
[COLOR=black]Pass 1: food.[/COLOR]
food: At 0, consuming to 15 with 8141417 meat.
[COLOR=black]Waiting to consume...[/COLOR]
<b>gnat lasagna</b> lev:10 gain:3.0 adv:19.0 musc:49.5 myst:0.0 mox:0.0 meat:3888 own:1 value:5037
(...)
0: [B]potion of the field gar[/B] price: 7800 value: 17200.0
Eating 1 gnat lasagna...
You gain 23 Adventures
You gain 47 Beefiness
You gain 3 Fullness
You gain 11 Mana Points
You lose some of an effect: Got Milk
Finished eating 1 gnat lasagna.

etc.
As you can see it considers the gnat lasagna, and decides that the best way to acquire it is to buy it for 3887 meat. It sets the auto-buy limit accordingly, and tries to acquire it, but instead of buying it for that price it attempts to craft it. Buying it manually and then running eatdrink again uses them from my inventory, even if it shouldn't if the acquisition logic is the same as in the first step (i.e. it is cheaper to craft them, than to use already crafted ones [zlib eatdrink_considerCostWhenOwned = true]). Any idea what is going on?

Just for reference, the prices for the possible materials are:
  • Gnatloaf: 1475
  • filet of tangy gnat ("fotelif"): 578
  • ancient spice: 250
  • gnatloaf casserole: 1499
  • Gnollish casserole dish: 150
  • gnat lasagna: 3888
  • dry noodles: 500
  • MSG: 1000
  • an adventure: 1000
Possible combinations are:

  • ancient spice (250) + filet of tangy gnat ("fotelif") (578) + Gnollish casserole dish (150) + MSG (1000) + dry noodles (500) + an adventure (1000) = 3478 meat
  • Gnatloaf (1475) + Gnollish casserole dish (150) + MSG (1000) + dry noodles (500) + an adventure (1000) = 4125 meat
  • gnatloaf casserole (1499) + MSG (1000) + dry noodles (500) + an adventure (1000) = 3999 meat
  • gnat lasagna = 3888 meat
Hmm, and looking at that it seems the script actually is going for the cheapest option, but that leaves the question of why that isn't the price it reports trying to get the lasagna for in the first place - and why it uses the ones from my inventory when eatdrink_considerCostWhenOwned is set to true.

Any ideas?
 
The acquisition code is just mafia - we use retrieve_item to let mafia get the item however mafia thinks is the cheapest. As to why it failed to acquire for you... do you have buying items from the mall or NPC stores disabled? Most of those items come from the mall, but the MSG might be cheapest through the NPC/guild store.

For that matter, is your guild unlocked? Right now with AoSP there's a bunch of people who finish short-aftercore without ever unlocking the guild...
 
It didn't fail to acquire for me, I hit escape when it asked if I wanted to spend turns crafting (maybe I should have mentioned that). But my understanding is that eatdrink tries to figure out what food-item gives the best return based on your current valueOfAdventure setting. In my case I believe it did that, and decided that the best food item for me was gnat lasagnas, which could be gotten in the mall for 3888 meat.

However, when it went to acquire the food-item it used mafia's acquiration code to try to get it, instead of buying it for that price. I guess I just got a bit confused about what the different settings described, and what was actually happening in my cli :P On a second look, it seems it acts as expected :) Sorry about that, I guess I will try to think a bit harder next time instead of going here to post :)

To sum up, I was confused about why the lasagna wasn't bought at 3888 when it was available at that price, but I see that it just tried to get it even cheaper.

What confuses me a tiny little bit is that eatdrink itself didn't price it at the cheapest available price, but I guess it simply doesn't figure out what the cheapest way to craft each and every foodstuff is?
 
Last edited:
What confuses me a tiny little bit is that eatdrink itself didn't price it at the cheapest available price, but I guess it simply doesn't figure out what the cheapest way to craft each and every foodstuff is?

EatDrink is a consumption script, not a farming script. As such, we don't try to figure out how cheap we can possibly get an item, we trust that the mall or historical price is good enough. If mafia knows that the item can be acquired for cheaper, it will do it for you. :)
 
The default value for valueOfAdventure is 500, increasing that might give you more desirable results.
Yah, it was at 1000 mpa for this character, as noted above... I just got a bit confused, I suppose this was the desired result - sort of :)
EatDrink is a consumption script, not a farming script. As such, we don't try to figure out how cheap we can possibly get an item, we trust that the mall or historical price is good enough. If mafia knows that the item can be acquired for cheaper, it will do it for you. :)
Fair enough :) I'll know till next time ;)
 
Yep. And if you want it to consider your VoA higher, just set it up. That will automatically make mafia not want to craft for the adventure if it makes it more expensive, but it will also spend more for the items. Which might be good, but... depends on how much you lie about your actual VoA. :)
 
So I tried again today with a slightly higher valueOfAdventure, I also added in a small scriptlet checking the costs of different combinations between running instance 1 and 2 of eatdrink. Something certainly seems to be up, but I suspect the issue may be with mafia's acquisition code? Any suggestions on where I should take this from here?
Code:
[COLOR=olive]> eatdrink (15,14,20,false,false)[/COLOR]
(...)
Consuming up      to 15 food, 14 booze, and 20 spleen
Considering food from inventory      closet Hagnk's Coinmasters NPCs the mall. Per-item budget cap is 125000.0.
Retrieval      cap is 40000. Price will be a factor if you own it already.
An      adventure has the value of [B]2000 meat[/B]. Mysticality subpoint is 0.0.      Nonprime stat subpoint is 0.0.
[COLOR=black]Pass 1: food.[/COLOR]
food:      At 0, consuming to 15 with 8403361 meat.
[COLOR=black]Getting 5      long pork lasagna in 1 seconds[/COLOR]
Countdown: 1 second...
Waiting      completed.
autoBuyPriceLimit => 5037.0
autoBuyPriceLimit => 40000
[COLOR=black]Something      went wrong with getting long pork lasagna for 4030. Recalculating.[/COLOR]
[COLOR=black]Pass      1: food.[/COLOR]
food: At 0, consuming to 15 with 8383211 meat.
[COLOR=red]KoLmafia      declares world peace.[/COLOR]
[COLOR=red]KoLmafia declares world      peace.[/COLOR]

[COLOR=olive]> lasagna_prices[/COLOR]

[COLOR=#000000]black      pepper (850) + long pork (117) + Gnollish casserole dish (150) + dry      noodles (555) + MSG (1000) + 1 adventure 2000 = 6672.
long      pork chop sandwiches (1275) + Gnollish casserole dish (150) + dry noodles      (555) + MSG (1000) + 1 adventure 2000 = 6980.
long      pork casserole (1785) + dry noodles (555) + MSG (1000) + 1 adventure 2000      = 7340.
long pork lasagna = 4030.
[/COLOR]
[COLOR=olive]>      buy 5 long pork lasag[/COLOR]

Searching for "long pork lasagna"...
Search      complete.
Purchasing long pork lasagna (5 @ 4,030)...
Purchases      complete.

[COLOR=olive]> eatdrink (15,14,20,false,false)[/COLOR]

Consuming up      to 15 food, 14 booze, and 20 spleen
Considering food from inventory      closet Hagnk's Coinmasters NPCs the mall. Per-item budget cap is 125000.0.
Retrieval      cap is 40000. Price will be a factor if you own it already.
An      adventure has the value of [B]2000 meat[/B]. Mysticality subpoint is 0.0.      Nonprime stat subpoint is 0.0.
[COLOR=black]Pass 1: food.[/COLOR]
food:      At 0, consuming to 15 with 8383211 meat.
[COLOR=black]Waiting to      consume...[/COLOR]
<b>long pork lasagna</b> lev:10 gain:3.0 adv:19.0      musc:0.0 myst:50.5 mox:0.0 meat:4030 own:1 value:11323
Countdown: 1      second...
Waiting completed.
[COLOR=black]Getting 1 milk of      magnesium in 1 seconds[/COLOR]
(...)
Finished using 1 potion of the field      gar.
0: [B]potion of the field gar[/B] price: 7800 value: 42200.0
Eating      1 long pork lasagna...
You gain 20 Adventures
You gain 56 Magicalness
You      gain 3 Fullness
You gain 13 Mana Points
You lose some of an effect:      Got Milk
Finished eating 1 long pork lasagna.
 
Unfortunately, your example never shows how it was trying to acquire the item. Might I suggest trying to use acquire 5 long pork lasagna rather than buy 5 long pork lasagna next time? If you have something that's causing problems, that should make it more obvious. EatDrink just uses retrieve_item - which is just the ASH version of acquire, the gCLI command - to get your stuff. Really the only custom code in item acquisition is dropping your autoBuyPriceLimit to the item's historical price that we're working off of multiplied by the price flexibility which you have set - 125% of normal by default - or your autoBuyPriceLimit, whichever is lower.

But since you acquired it for 4030 successfully, it doesn't make any great reason why mafia would have failed...
 
Yeah, it seems mafia tries to craft it when I use acquire too.... It may just be that the adventure isn't calculated into the acquisition cost? Mafia really doesn't print any information about why it does what it does when I use "acquire long pork lasagna" though - it just goes straight to the pop-up of whether I want to spend turns crafting or not. Is there any way to make it more verbose?

Prices when I attempted this:
Code:
black pepper (850) + long pork (113) + Gnollish casserole dish (150) + dry noodles (555) + MSG (1000) + 1 adventure (2000) = 4668.
long pork chop sandwiches (1240) + Gnollish casserole dish (150) + dry noodles (555) + MSG (1000) + 1 adventure (2000) = 4945.
long pork casserole (1629) + dry noodles (555) + MSG (1000) + 1 adventure (2000) = 5184.
long pork lasagna = 4030.
 
Hmm, the information printed from that really isn't all that useful in figuring out why it attempts to create instead of buying either:
Code:
[COLOR=olive]> debugcreate long pork las[/COLOR]

- long pork chop sandwiches limited to 0 by long pork
- long pork casserole limited to 0 by long pork chop sandwiches
- long pork lasagna limited to 0 by long pork casserole
long pork lasagna.canMake(1) => 0
 
Take a peek at the "Item Manager" in "Creatable->Fine Tuning" and if you don't want it to craft without box servants, set that. Also, you can see that by default, mafia considers items in your inventory as a bit cheaper than mall price... if you want to set that higher, you can - even prices with the mall, or even making it more expensive to use your inventory. But the answer you're looking for is almost certainly in mafia's settings, not something that's a part of EatDrink. :)
 
Yeah, I'd forgotten to check that box, but when I check the value of my inventory, I get:
Code:
valueOfInventory (user, now '2.0', default '1.8')
Which I think sets it equal to mallprice? And even if I hadn't checked that box, shouldn't mafia have considered the cost of my adventures before attempting to craft something? Anyway, you are correct that this probably has little to nothing to do with your script anymore... I guess I should move my questions either to community support or to bug-reports...
 
It's almost certainly not a bug-report, just failing to understand the specifics of what works how and why. I don't know why mafia prefers to craft for you. Someone should hopefully be able to help work that out though.

At some point a speculative retrieve_item function was requested that would have helped with debugging some of these things for you. Unfortunately it never happened. Or maybe it did and I just never noticed that revision.
 
I noticed it doesn't support Pete's Best Dressed in the tuxedo code. This should fix it:

Code:
boolean tuxworthy(item it)
{
  return (tuxable contains it) && (have_item($item[tuxedo shirt]) > 0) &&
    (have_skill($skill[Torso Awaregness]) || have_skill($skill[Best Dressed])) && can_equip($item[tuxedo shirt]);
}
 
Seems a bit redundant, seeing as can_equip(item) accounts for Torso awaregness etc:
Code:
> ash can_equip($item[origami pasties])

Returned: false
 
For some reason, EatDrink hasn't been filling my spleen. When I start at 0 and tell it to fill it up to 15, it instead just fills it up to 14 (e.g. 3 x groose grease, 1 x antimatter wad). And when it's already at 14 and I tell it to fill it to 15, it does nothing. My valueOfAdventure is set to 1250, so just filling that last space with a twinkly wad would be profitable (though other choices may be better).
 
Back
Top