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

fronobulax

Developer
Staff member
5 turns of milk was essentially a typo.

If eatdrink_suppressNoMilk is false then I would expect it to trigger either before I eat anything or not at all, unless ED is coming to some conclusions that are counter-intuitive enough that they are worthy of a line or two of output. The character in question is in ronin, at the moment, VOA of 500 and running ED from Ascend with a max of 5000 meat in the closet. I will try and run things tomorrow so I can tell you more about what is happening. (The non-ascending character has no problems and the other character can eat better manually because I have not taken the time to tun things so ED will consume the better foods).
 

Theraze

Active member
If suppressNoMilk is false, it uses eat. If it's true, it uses eatsilent. Either way, it will try to get enough milk during the actual consume phase, which is after the acquisition phase, which is after the selection phase. Basically:
1) Decide on a full set of food to eat. Stop partially through if using KLP, otherwise, get as close as possible to max desired consumption.
2) Get all of that food.
3) Start eating.
3a) On eating the first item, check if we can get milk for the remaining stack. If we can, do so. If it will take 2, loop the milk acquiring.
3b) Eat the item at the front of the stack.
3c) If the stack is done, go to 4. If there are more items on the stack and the last milk acquisition succeeded but we don't have enough for the next item, go back to 3a, otherwise return to 3b.
4) If we had a KLP or one of the steps in 1-3 failed (besides milk), go back to 1 with new beginning fullness.

But yeah... whining on every step of the way is a mafia thing, not an ED thing, since we're just using the "eat" ASH function. If it happens again, could you check creatable_amount($item[milk of mag]) as well as available_amount($item[milk of mag])? If it's possible, it definitely should use it... Maybe that character has the items stored in the closet and that turned off or something similar though. Or likely the code has some sort of issue... but I always see it trying to retrieve milk even when it's impossible. If it's possible for you and failing to try? That's odd.
 

fronobulax

Developer
Staff member
So it didn't do it this morning. Looking at things my best guess is that there previously wasn't enough meat to buy two milks so ED properly bought and used one after which the unsuppressed prompt kicked in. I need to think through exactly what I would like and then think some more to see whether that is really A Good Thing but for moment if ED knows/plans to consume something without milk or ode then perhaps it should just write that as an informative message. Heaven knows it is verbose enough as it is :)
 

Theraze

Active member
What I currently do to see the decisions is run my simulation... if there's enough meat to completely use milk/ode, it will display in the simulated summary. If there isn't enough, it will skip trying at all during the sim.

If you look at the get_meat function, I've overloaded that to provide for meat usage on various steps of simulating and the like... we might eventually be able to set a EatDrink_stepMeat variable or the like, probably named STEP_MEAT internally after it gets loaded, offering maximum meat used per step to function as an addition to the maximum value of items. The maximum item value will eliminate created/bought items that are already in your inventory... the STEP_MEAT would be the maximum amount for each step you'd like it to be able to purchase/use for creation. This would mean if you have an incredibly high (or just the default of 20k) auto price, you'd still potentially get stew and other valuable options, but it might only use them if they're available directly from your non-meat-outlay choices, because buying one would use up more than your 'max' meat.

Basically, the benefits of closetting meat, without actually needing to do it. If it works right. This should function as min(STEP_MEAT, my_meat) for item acquisition. I'd probably leave ode/milk outside the step limit, so if you've said you wanted ode/milk, it will always try to get them if you actually have enough meat for it, since it's a cheap way to get an extra 5-15 (bad ode-permed milk) adventures for under 1000 meat guaranteed.

Edit: To speed things up earlier on, put a minimum level check back into the item loading, but put it into the second level load... If you read back a few pages, I took Veracity's awesome advice about preloading the item data first so we don't need to parse the full item list every time. I had earlier put the level check into that, but if we're using TPS drinks and end up levelling up, it's possible that we might care to reconsider what we're going to finish up with, etc. Anyways, the version of the possible items that we actually eliminate items from will only load up items that can actually be consumed there, which should actually be able to eliminate a full execution of the item checking... did put the notification into the loading though, for people who actually use favorites for a trophy or who love getting spammed by the verbose2 output.
 
Last edited:

apenny

New member
Hi folks,

Just a quick note. First I want to comment that EatDrink is an absolutely wonderful script and I have been using it for ages and find it invaluable. However, I know I (and probably others) struggle a bit going through the 113 pages of notes to keep up with the current version of EatDrink. Would it be possible to keep the latest version for the new mafia in the first post? THe older version could also be preserved there (labeled as for versions earlier than XXX) for those still living in that era.

Thanks so much for a great tool.
apenny
 
Last edited:

fronobulax

Developer
Staff member
The reason the latest version is not in the first post is because the latest version does not work the most recent SourceForge release of mafia. Furthermore the latest, latest version contains some beta code that needs some refinement and testing before it becomes the official version. So the roadmap at the moment is that once the SourceForge release of mafia changes, the version of ED that works with it will be "released" and posted to the first post. At some point after that a decision will be made to make Theraze's excellent work part of the release and then it will have a place of honor on the first post, as well as a version number change that will tell everyone there is a newer version.

But yes, it is confusing and not the way things would have been handled if the change to mafia had not occurred when it did.
 

fronobulax

Developer
Staff member
In ronin. Meat poor - less than 25. Not considering cost when owned. Drunk at 14/14 and run to overdrink. "You don't have 1 cranberry schnapps and you're not able to shop.". I would have expected it to try and look for something else for me. Old EatDrink pulled the schnapps so this is may be one of those cases where you claim the old version overvalues things. It may also be as simple as the decision to actually pull something is not executed properly and the failure does not trigger reevaluation. There was accidental cider in my inventory so I would have expected ED to consume it rather than just stop.

Tangentially, the old version consumed strongness elixir and moxie weed for spleen, which I have never seen before. That may be the result of no longer considering the cost when owned but it was nice to see.

Looking way far ahead, given that ED does use zLib it would be nice to convert some of the output so the zLib verbosity applied. Step one might be as simple of replacing the commented out call to print with an appropriate zLib call.

I'm also wondering about something I'll call froMode for the moment. In froMode, if you are out of ronin and have a mall store then ED uses as much of mafia's logic and preferences as possible to obtain something. In particular it will buy rather than create when the whole costs less than the parts. If you are in ronin or don't have a store then froMode will always use and consume from inventory with a safety that things with a historical price greater than a threshold will never be touched. Quality filters would not apply so it would eat junk rather than do nothing. Just thinking at the moment.
 

Theraze

Active member
See, as it currently stands, if you want to eat junk, you apply a filter that turns your minimum quality or minimum average to 0... I default to a minimum quality of 1 and average of 0/1 (whichever it defaults to there). When I'm low meat/items, I'll run mq 0 with my eatdrinkmq alias... well, specifically eatdrinkmq 0, but same difference. But generally I don't need to run that after day 1 or 2.

Most likely, it used your stat consumables because their 'cost' was 0 and value was prime/sub stat * 10/2. So a 9.9 muscle on primestat would have a value of 99 and a cost of 0, making it a positive item... the problem normally is that they rarely become a 'positive' value, due to the the value of 10 thing and costing, what, 100 meat? So... value of -1. No use.

Regarding your froMode... that would probably be some sort of internal hack. Not seeing that as a 'normal' thing, but some form of the discounting of item-price will likely happen. It's the "checking for store and disabling your mallbuy" that I don't see as especially likely. :) Especially because that really screws with the whole creatable system... most people's direct inventory kinda sucks, but they can make some nice expensive items after a bit. Do we skip these because they take other expensive ingredients, or do we just say that because they have part of it, it goes on...

Regarding vprint... just need to know what values to put where. The current system does have the benefit of not screwing up when people kill their verbosity, but... eh. I'm fine with that going away. At very least, the decisions above could go to 5 or so, the summary should be a 1-3, and the verbose2 should be a 8-10. Possibly a range depending on just how spammy it is.
 

fronobulax

Developer
Staff member
Just for you, I deleted all of the eatdrink variables for the character that is having the worst diet. Things were better. Don't know whether that was because the character was advancing in level or because one of the variables was not at a default value and thus excluding things from consideration. I noted that it wanted to use square grapes and brown sugar cane. That makes sense since the items were sometimes available from Chez Snootie but since I know they are not available at the moment the attempt was noteworthy. An observation, not a suggestion for changes since I am reasonably sure this is the desired effect of using existing mafia preferences.
 

Theraze

Active member
Hmm... is there any way to tell what the currently available items are? What does npc_price square grapes and npc_price brown sugar cane say? Having mafia be more aware of what's available would be a FReq for there... not that it can know initially, but after it looks once, it should be aware for the rest of that rollover on what's available to save server hits. :)
 

Theraze

Active member
Okay... here's my current version and a summary of what features I'm thinking about adding still. The first number is the post it was last mentioned at length, and a summary of what remains. If you have any other FReqs, let me know and I'll try to work them in if you can sell it well enough. :D

Implemented since last mentioned:
1101: Remove ability to set overrides for acquisition locations - can still override during simulation, but during actual execution it will always use mafia preferences

To be done - Definitely:
1069: Coinmaster (besides hermit) handling - Need decision on token mall price, item mall price, or lowest of the two - will probably use retrieve_item on tokens but will need custom override for hermit due to available_amount not calculating how many we can get with gum
1120: Chocolates use new get/stack code to improve simulations
1124: STEP_MEAT and EatDrink_stepMeat - want to be able to set max meat per step so closetting meat isn't required
1128: Use vprint instead of verbose and verbose2 - Need to decide on what gets displayed at which levels

To be done - Maybe:
1116: get_ronin means autosell_price instead of mall_price (probably on variable)

Other posts of interest:
1072: Amuses me by having confused worthless and valuable items
1116: EatDrinkO for people who want post 1 EatDrink functionality in daily mafia

Edit: Added vprint above. Replaced the attachment with one that doesn't think that it can buy quest items in aftercore. If any of the 6 people that had grabbed the script earlier are in aftercore, you'll probably want this update.
 

Attachments

  • EatDrink.ash
    95.6 KB · Views: 34
Last edited:

fronobulax

Developer
Staff member
"Function 'eatdrink( int, int, int, boolean, boolean, boolean, boolean, boolean, boolean, boolean, int, float, boolean, int, int, int, int, boolean, int, int, boolean, int )' undefined. This script may require a more recent version of KoLmafia and/or its supporting scripts. (Ascend.ash, line 60)"

Ideally you would provide a version that has the old signature so that Ascend does not break. From a quick glance it looks like several old variables would get ignored and a couiple new ones would still get defaults. Once you have done that we can modify Ascend to use the up to date version but until a new version of Ascend goes out ED needs to provide the old signature.
 

Theraze

Active member
Yeah... suppose we can make a copy that ascend believes is still actually useful, but that removes the actual redefining on consumable locations... Here we are. Also, the legacy part now says it's for people running dj_d's ascend, not for people who want full control. Makes it easier to remember what it is and why it's there, for later removal.

So here's the "ascend users are still people too, sort of" version. :)

Edit: I'll try to test this again, but... next version will use (!adventure(1, lemon party)) instead of adv1(lemon party, 1, ""). The new one shouldn't abort if you have goals, run eatdrink, the variable set, and it crafts your RnR legend for you.
 

Attachments

  • EatDrink.ash
    96.9 KB · Views: 28
Last edited:

Theraze

Active member
Very minor testing on the 1116 change. AUTOSELL_RONIN is in my test build currently... we'll see if it sticks around. Normal item choice for 1 fullness and overdrink:
Simulating only; no purchases or food/drink/spleen consumption.
food: At 14, consuming to 15.
1: overcookie lev:3 gain:1.0 adv:2.0 musc:4.0 myst:4.0 mox:4.0 meat:100 own:1 value:1956
spleen: At 0, consuming to 15.
At drunkenness of 14. Overdrinking.
0: Ode to Booze price: 0 value: 4000
1: ocean motion lev:4 gain:4.0 adv:12.0 musc:26.0 myst:9.0 mox:0.0 meat:1050 own:1 value:11020
choc: Checking non-filling crimbo chocolates - all 3 kinds
Best find was chocolate disco ball with a value of -750. That's no good, so not consuming and moving on.
Finished.
Spent 0 meat for a value of 1150 meat. Gained Fullness: 1. Inebriety: 4. Spleen: 0.
Adventures: 18. Muscle: 30. Moxie: 4. Mysticality: 13.
Eating, drinking, and spleening complete. Commence merrymaking (at your own discretion).
With AUTOSELL_RONIN true:
Simulating only; no purchases or food/drink/spleen consumption.
food: At 14, consuming to 15.
1: overcookie lev:3 gain:1.0 adv:2.0 musc:4.0 myst:4.0 mox:4.0 meat:38 own:1 value:2018
spleen: At 0, consuming to 15.
At drunkenness of 14. Overdrinking.
0: Ode to Booze price: 0 value: 4000
1: perpendicular hula lev:4 gain:4.0 adv:12.0 musc:0.0 myst:0.0 mox:35.0 meat:115 own:1 value:12235
choc: Checking non-filling crimbo chocolates - all 3 kinds
Best find was chocolate disco ball with a value of -750. That's no good, so not consuming and moving on.
Finished.
Spent 0 meat for a value of 153 meat. Gained Fullness: 1. Inebriety: 4. Spleen: 0.
Adventures: 18. Muscle: 4. Moxie: 39. Mysticality: 4.
Eating, drinking, and spleening complete. Commence merrymaking (at your own discretion).

Summary: 18 adventures both ways, this is moxie class so moxie is 10, others are 2 value. As such, the OM is worth (30*2)+(4*10)+(13*2) for a total of 60+40+26=126 additional value. The PH is worth (4*2)+(39*10)+(4*2) for a total of 8+390+8=398 additional. Both were 'valued' at 115 meat, so the PH was the better choice under that circumstace... Well, mostly. :) The overcookie gave 4/4/4 stats, so the comparison is a bit more unbalanced than it looks, since 48 of each's value was from that, but the point holds.

Anyways, this will probably get into whatever my next upload is, unless I decide to kill it first. This doesn't make items have NO value, just uses autosell if you've
1) told it to use that during ronin,
2) you're currently in ronin,
3) you have some amount of that item currently available (item.have > 0, so you aren't buying it from NPCs) and
4) the item does have an autosell price (so distilled fortified wine will still be using its normal value, for example).

I was thinking of avoiding using this, but since I'm not likely to try to be the cheap DB cocktail merchant, I might as well get good drinks, etc... :)

Edit: Added another check to the budget bit... if we have to buy an item from the mall and it costs more than our autoBuyPriceLimit, don't try to buy it even if it's under our "budget" for single biggest item. The budget value allows us to have a higher limit on items we've already acquired either manually or in the past without making us have failures in our display when it tries to buy mulligan stew for 20,000 meat or something else similarly unlikely to work.

Code change summary: if item has mustMall tagged to get, and item.price > autoBuyPriceLimit, eliminate item from possibilities.

Edit2: Have added STEP_MEAT to my personal copy, defaulted to 10k meat spent per stage. Most people will want it lower, but it does mean that EatDrink should by default spend no more than 40000 meat total for food, booze, spleen, and overdrinking, regardless of how high you've set your personal value of adventure. If you set it high enough, I'm sure that the chocolates can still bankrupt you, but... need to set them to be step 4 and move overdrinking to 5 at some point soon. :)

Sidenote regarding STEP_MEAT. In simulation with 1000 max spent per step, it used the same stack for booze regardless... Mae West, 2 tangaritas, 2 fine wine, and another tangarita for the overdrink. They're just sitting waiting in inventory. What changed was when it decided to use ode... When it was able to spend as much as it wanted, it cast ode for the whole stack and it cost 1581 meat for 14 adventures. When it only got to spend 1000, it cast ode after the Mae West and only cost 731 meat for those 10 adventures. So it did appear to work for deciding how much meat it has available to spend... I might do some more simulations, but won't give it a serious try until I next hit aftercore consumption briefly... which reminds me, I might have a character there. :) I might set their VOA up to 5k and leave STEP_MEAT at 10k, and see how it accomplishes this best... with a few huge items or by using a more moderate set.
 
Last edited:

fronobulax

Developer
Staff member
So ED decided to consume my gin soaked blotter paper while I was in the middle of the quest. Perhaps an option to avoid it, similar to wet stunt nut stew should be considered?
 

Theraze

Active member
You can do that... anything that's in eatdrink_avoid_ will get skipped. So to skip the paper, eatdrink_avoid_gin_soaked_blotter_paper=true.

Edit: Bit of STEP_MEAT testing... simmeat of 58k, VOA 5k, SM -1 (unlimited), 210 adventures for 42.3k meat. simmeat of 58k, VOA 5k, SM 10k, 191 adventures for 18.4k meat. Seems to be working as it should... will test it a bit longer before spinning though.
 
Last edited:

Theraze

Active member
Actually, it doesn't avoid automatically eating wet stunt nut stew... it only avoids the wet stew. Since that's the consumable... Anyways, changed it to have this now by default:
Code:
setvar("eatdrink_avoid_"+replace_string(to_string($item[booze-soaked cherry])," ","_"), true);
setvar("eatdrink_avoid_"+replace_string(to_string($item[giant marshmallow])," ","_"), true);
setvar("eatdrink_avoid_"+replace_string(to_string($item[gin-soaked blotter paper])," ","_"), true);
setvar("eatdrink_avoid_"+replace_string(to_string($item[sponge cake])," ","_"), true);
setvar("eatdrink_avoid_"+replace_string(to_string($item[wet stew])," ","_"), true);
 

Theraze

Active member
Sure, why not... let's let people try this out. So, using the new tracking system...

Implemented since last mentioned:
1116: get_ronin means autosell_price instead of mall_price using eatdrink_autosellRonin variable
1124: STEP_MEAT and EatDrink_stepMeat - want to be able to set max meat per step so closetting meat isn't required
1135: Skip Steel Organ arena consumables by default similar to the wet stew

To be done - Definitely:
1069: Coinmaster (besides hermit) handling - Need decision on token mall price, item mall price, or lowest of the two - will probably use retrieve_item on tokens but will need custom override for hermit due to available_amount not calculating how many we can get with gum
1120: Chocolates use new get/stack code to improve simulations
1128: Use vprint instead of verbose and verbose2 - Need to decide on what gets displayed at which levels

Other posts of interest:
1116: EatDrinkO for people who want post 1 EatDrink functionality in daily mafia

Next will likely be the 1120 change, unless people actually let me know what levels they want for vprint and 1128.

Note on STEP_MEAT... I'd originally thought of using 0 as the unlimited/full meat usage, but decided that people might want to know what they can get without actually spending any meat, just using their supplies. Instead of forcing them to use 1, decided to make it check for negative numbers as unlimited, so use -1 or something else like that if you want it to burn all your meat. :) Part of debugging this also meant that I added in a display for how much meat it was planning on trying to use per step. If you see something bizarre, such as it trying to use 10k meat when you only have 3k... let me know. Otherwise, it's there to let you know when you ran out and it had to downgrade... especially good when simulating.

Edit: Did find one issue due to the extra STEP_MEAT display. EatDrink believes that meat is used even if an item fails to be retrieved. Not sure if there's a good way to avoid this, but it can matter if you're incredibly meat-poor (or closet) and the item-fail causes you to go into negative meat. Had this happen when trying to drink an overpriced import before officially unlocking the tavern.

Edit2: This could also happen tied into creating items that require fancy implements when you either don't have enough meat to buy them, or if the value of the completed item with flexibility is still below 1000, so it can't buy the range/cocktail. Believe it's painful penne pasta where this often happens, but it might have been one of the other standard cheap noodle-burn dishes. Might try to avoid the <1000 issue by forcing the price limit to at least 1000, if it's set higher, even if that's above your standard item cost*flexibility. We aren't looking at much of a change, and the only people it might possibly negatively affect would be if someone sets a relatively rare 1 space item as a favourite and the top 5 stores each have a low price (100) and the 6th is around 1000 and that makes it not the best choice... but since they've marked it as a favourite, it would get preferred anyways, so it wouldn't even affect them really. If someone can come up with a more real-world example of why that would be a bad idea, I'll skip it, else expect to see 1000 as the minimum value if your original value is set at/above.

Also moved the setting of autoBuyPriceLimit from just before the try into the try itself, so that if you abort at EXACTLY the wrong time, it shouldn't leave your aBPL wrong. I know mine got messed up at one point, so... hopefully that should fix it.
 

Attachments

  • EatDrink.ash
    98.6 KB · Views: 34
Last edited:

Theraze

Active member
Not going to remove the item just above, but putting this version out. I didn't completely scrap the chocolate code, but rather reworked set_prices to call set_price (new function) to set the availability on a single con_rec. By doing that, I can have it check for chocolate prices and availability.

This helped me to discover that it was still saying that items were available from the mall when the mall was locked due to being in HC/ronin... this should speed up general execution since it isn't needing to consider all of the unavailable items as it's working through.

Going back to the chocolate change, basically, it should check if the chocolates are available and if not, don't tell you how well they work. If you're in HC, it doesn't matter whether those chocolates are worth -1200 or 3300 meat based on your VoA, you're not eating them if the only source is the mall, so... :) Not removing the 1139 entry because I haven't gotten to test this on chocolates, being fully-ronin at the moment, but... hopefully in a few days I can use simulation to get yelled at again about how it's not a great deal for me. :)

Implemented since last mentioned:
1120: Chocolates use better availability checking to reduce messages to the user.

To be done - Definitely:
1069: Coinmaster (besides hermit) handling - Need decision on token mall price, item mall price, or lowest of the two - will probably use retrieve_item on tokens but will need custom override for hermit due to available_amount not calculating how many we can get with gum
1128: Use vprint instead of verbose and verbose2 - Need to decide on what gets displayed at which levels

Other posts of interest:
1116: EatDrinkO for people who want post 1 EatDrink functionality in daily mafia
 

Attachments

  • EatDrink.ash
    99.9 KB · Views: 29
Top