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

fronobulax

Developer
Staff member
#1260 seems to be behaving. It bought boxen for two characters that didn't have them (although I should check all of the relavent settings). It does appear that my diets have changed slightly but in the one case I checked it is because limes are cheaper than cherries.
 

fronobulax

Developer
Staff member
Triple post :)

#1260 seems to have some problems with spleen. A couple of times I have asked for spleen to 15 and it has stopped at 13. No obvious constraints preventing it from buying whatever it wants and re-running will pick up the extra two. A counting error, perhaps? In any event I'm posting now but will provide more details, if needed, once Crimbo and Christmas calm down.
 

Theraze

Active member
Nope... that's STEP_MEAT working as it should. Similar to before with closetting meat, it's not supposed to spend more than STEP_MEAT (or stepMeat, if you're looking at the variable), per step. So by default, that's 5k meat spent total for food, 5k for drink, 5k for spleen, and 5k for overdrink, for a total budget of not more than 20k meat for the whole day. If you want to keep spending, set your step_meat to -1 or anything negative. This allows for 0-spending with surprising fist or other such paths.
 

fronobulax

Developer
Staff member
OK - I'l check, but if STEP_MEAT is a cap on daily spending as you said then how come running ED immediately fills up the remaining spleen? Is your explanation a bit off or is it possible the code isn't doing what you expect it to? Thanks, and Merry Christmas (since that's what I'm celebrating).
 

Theraze

Active member
It's a cap on this specific execution of EatDrink running each step. So if you have STEP_MEAT set to 0, and run ED 5 times, it will try to use only your inventory and not spend a single meat to get you the best amount of adventures possible, based on your given Value of Adventure. Set STEP_MEAT to 5000 as per default, and it will spend up to 5000 meat per step... so up to (but probably not reaching) 15000 meat, with 5000 for food, 5000 for drink, and 5000 for spleen... it doesn't roll over though, so if you spend 1000 for food, it doesn't mean that drink gets 9000... just the normal 5000.

I've found that with 5000 meat, what I normally get for spleen is between 6-12 spleen fullness depending on if it decides to go with twinkly wads or orcish pastes and so forth. Just depends on the market that day. If that happens, I can just run ED again, and it will either finish (or add another 6) spleen, spending another 5000 meat. And if I'm at 12 after the second execution, a third will complete it, generally spending 1-2 thousand more meat to finish it off, since it doesn't have enough for a paste.

Currently I've changed my characters to use a STEP_MEAT of 10000 instead of 5000, and changed the (newest, but not yet uploaded) version to have that as the default. Why? Because buckets of wine are nice for overdrinking, and I'll spend the 7000 meat for those 28 adventures. That being said, with normal VoA settings (not set to 1250 or whatever I'm currently at, to make it use supercocks) it will stick with fruity drinks and 20-ish adventures on the overdrink for 400 meat. :) That's not really too related to STEP_MEAT, just a bit of noting so I hopefully remember it for the changelog. Also tweaking it to try to run more intelligent alternative speculative VoA bits, to hopefully save people some meat and get more adventures squeezed out. Anyways... back to STEP_MEAT.

With 5000 max meat, you can either get 12 adventures (plus ~10 of each stat, each) with 12 spleen for 4800, or 7.5 adventures (5-10) for 4 spleen (along with ~20 of each stat) for 3700 plus another 3 adventures through twinkly wads for the 1200 meat. Total running ED 3 times with the pastes gives ~22 adventures. Total running ED 2 times with twinkly is 15 adventures. So if your VoA is set high enough to make the pastes worthwhile, that's nice.

Anyways, I'm just barely awake enough to realize I've hit late night rambling mode. If your goal is to make it only run once, set EatDrink_stepMeat to -1, but simulate in aftercore at least once or twice before setting it loose. If you're fine watching it a bit closer, note that you can limit how much meat it can spend with STEP_MEAT, but it might not completely fill up. It will do its best using the meat allocated to it, but won't (or at least, shouldn't) over-use. It's possible that, if mojo filters are considered a good investment based on your Value of Adventure, it might consider each running a separate step with its own meat... but the fact that it kept re-running over and over with the spleen before, giving it the full STEP_MEAT each time was a bug, not intended behaviour. :)

And Merry Christmas.
 

bsander

Member
It's still supposed to take the value of eatdrink_budget into account, even if eatdrink_budget is less than 4 * eatdrink_stepMeat, right? because I set eatdrink_budget at 20k and eatdrink_stepMeat at 10k, and ED ended up spending 30K meat even before overdrinking. Is that a bug or am I misunderstanding the way it works?

Also, would it be possible to not pause for everything while simming? That would speed my tweaking disorder up a lot!
 

fronobulax

Developer
Staff member
Now that Crimbo is over, let me note that I think the STEP and the BUDGET values need to be coordinated (or have one made dependent on the other) and that they should persist across invocations of ED. Having expressed that opinion, I hopefully will take the time to verify that it is A Good Idea and act accordingly.
 

Theraze

Active member
Budget is the maximum value for a single item. With a budget of 20k, it won't use items like cranberry go-goo that's worth 105k, even if you have your VoA set to 100k per adventure.

Step is the maximum spent amount for the whole stage. With a step of 20k and a budget of 200k, it might end up using up to 3-4 million worth of items per step... but won't actually spend more than 80k total.

autoBuyPriceLimit, a mafia preference, is the maximum that you will allow mafia to spend to acquire those items. If aBPL is set to 20k, the default, step is set to 50k, and your budget is set to 200k... mafia will still only spend at most 20k for an individual item.

Working solely on defaults, budget defaults to 20k, step defaults to 10k, and mafia's aBPL defaults to 20k, making aBPL irrelevant since it's higher than step and EatDrink should never actually want to spend twice its total for a single item.

Does that make sense? The point of the two is that you can decide on the value of your inventory to you without needing to worry as much about your liquid meat. If you never plan on ever opening a mall store, you can set your budget sky-high and your step meat low, and EatDrink will use the best of what's available without burning through the actual meat that you want. If you have, or plan on someday having, a mall store and so the value of your inventory is important to you, then keeping the budget at a lower number is useful. It's a much more granular version of the consider cost when owned variable.
 

bsander

Member
Thanks Theraze, I think I understand. I was trying to archieve a method that would not spend more than X total on a single day, but that X could be spent freely over all 4 stages, instead of a fixed maximum of X/4 per stage. Is there any way I can still accomplish that?
 

Theraze

Active member
Use a closet wrapper with -1 step meat, which allows it to use all of your meat. So the closet wrapper puts all your meat except 10000 or whatever into the closet, launches EatDrink with the ability to use all your meat which is 10000 currently, and then the wrapper takes the rest of your meat back out later... I think that dj_d's Ascend involves a closet wrapper, if you've bought that.
 

fronobulax

Developer
Staff member
I wrote the Ascend wrapper so here it is.

Code:
//This is a wrapper for eatdrink.  It checks the daily budget against the amount spent
//by EatDrink.  It closets meat so that Eatdrink cannot exceed the budget, calls EatDrink
//and then restores the meat.  Daily limit will get hosed if, for whatever reason, EatDrink
//does not return here after being called.  Ignores SIM parameter and any parameters
//that might logically prevent EatDrink from spending

void eatdrinkWrapper (int foodMax, int drinkMax, int spleenMax, boolean overdrink,
	       boolean use_inv_p, boolean use_closet_p, boolean use_storage_p, 
	       boolean sim_consume_p, boolean supress_overdrink_p, 
	       boolean shop_p, int budget_p, float price_flexibility_p, 
	       boolean consider_cost_when_owned_p, int cost_of_pull_p, 
	       int value_of_adventure_p, 
	       int value_of_prime_stat_p, int value_of_nonprime_stat_p, 
	       boolean pie_priority_p, int price_of_nontradeables_p,
	       int price_of_unknowns_p, boolean sim_ronin_p, int sim_level_p)
{
	int spentToday = to_int(get_property("_Ascend_EatDrinkSpentToday"));
	int allowedThisCall = max(0, eatDrinkBudget - spentToday);
	int beginMeat = my_meat();
	int toCloset = max(0, beginMeat - allowedThisCall);
	if (toCloset > 0) {
		put_closet(toCloset);
	}
	int startMeat = my_meat();
	debug("EDW Before "+spentToday+" "+eatDrinkBudget+" "+allowedThisCall+" "+beginMeat+" "+toCloset+" "+startMeat);
	eatdrink (foodMax, drinkMax, spleenMax, overdrink,
	       use_inv_p, use_closet_p, use_storage_p, 
	       sim_consume_p, supress_overdrink_p, 
	       shop_p, budget_p, price_flexibility_p, 
	       consider_cost_when_owned_p, cost_of_pull_p, 
	       value_of_adventure_p, 
	       value_of_prime_stat_p, value_of_nonprime_stat_p, 
	       pie_priority_p, price_of_nontradeables_p,
	       price_of_unknowns_p, sim_ronin_p, sim_level_p);
	int endMeat = my_meat();
	int deltaSpend = startMeat - endMeat;
	spentToday = spentToday + deltaSpend;
	set_property("_Ascend_EatDrinkSpentToday",to_string(spentToday));
	if (toCloset > 0) {
		take_closet(toCloset);
	}
	debug("EDW After "+endMeat+" "+deltaSpend+" "+spentToday);
}

The problem with Ascend, in this context, is that at one time it wanted to micromanage EatDrink, hence all of the parameters. Of course, some of them have been outdated and only exist in EatDrink because I required Theraze to keep backwards compatibility.

As for the general baroque feel of the EatDrink controls, I guess I really should just set the steps to -1 and let other parameters actually control the process.
 

Theraze

Active member
Tweaked the wrapper to use print instead of debug, since that's a part of Ascend that someone creating an EatDrinkWrapper.ash file won't have inside. Also, made it use try/finally so that it should withdraw your meat even if you have to abort EatDrink. And for a third tweak, updated the EatDrink call to use the current set of EatDrink full parameter functions, so it allows disabling accurate crafting costs, etc.
Code:
import <EatDrink.ash>

//This is a wrapper for eatdrink.  It checks the daily budget against the amount spent
//by EatDrink.  It closets meat so that Eatdrink cannot exceed the budget, calls EatDrink
//and then restores the meat.  Daily limit will get hosed if, for whatever reason, EatDrink
//does not return here after being called.  Ignores SIM parameter and any parameters
//that might logically prevent EatDrink from spending

void eatdrinkWrapper (int foodMax, int drinkMax, int spleenMax, boolean overdrink,
	       boolean sim_consume_p, boolean supress_overdrink_p, 
	       boolean accurate_p, int budget_p, float price_flexibility_p, 
	       boolean consider_cost_when_owned_p, int cost_of_pull_p, 
	       int value_of_adventure_p, int value_of_prime_stat_p, 
	       int value_of_nonprime_stat_p, boolean pie_priority_p, 
	       int price_of_nontradeables_p,int price_of_unknowns_p, 
	       int price_of_questitems_p, boolean sim_ronin_p, int sim_level_p)
{
	int spentToday = to_int(get_property("_Ascend_EatDrinkSpentToday"));
	int allowedThisCall = max(0, eatDrinkBudget - spentToday);
	int beginMeat = my_meat();
	int toCloset = max(0, beginMeat - allowedThisCall);
	try {
		if (toCloset > 0) {
			put_closet(toCloset);
		}
		int startMeat = my_meat();
		print("EDW Before "+spentToday+" "+eatDrinkBudget+" "+allowedThisCall+" "+beginMeat+" "+toCloset+" "+startMeat);
		eatdrink (foodMax, drinkMax, spleenMax, overdrink,
		       sim_consume_p, supress_overdrink_p, 
		       accurate_p, budget_p, price_flexibility_p, 
		       consider_cost_when_owned_p, cost_of_pull_p, 
		       value_of_adventure_p, value_of_prime_stat_p, 
		       value_of_nonprime_stat_p, pie_priority_p, 
		       price_of_nontradeables_p, price_of_unknowns_p, 
		       price_of_questitems_p, sim_ronin_p, sim_level_p);
		int endMeat = my_meat();
		int deltaSpend = startMeat - endMeat;
		spentToday = spentToday + deltaSpend;
		set_property("_Ascend_EatDrinkSpentToday",to_string(spentToday));
	}
	finally {
		if (toCloset > 0) {
			take_closet(toCloset);
		}
	}
	print("EDW After "+endMeat+" "+deltaSpend+" "+spentToday);
}
 

Theraze

Active member
Quick[ish] talking through my settings.
eatdrink_accordionGet true
Get accordion automatically if you don't have one yet. Stolen if nothing else, Rock and Roll Legend if possible. Saves meat immediately if you're using any type of familiar besides 100% starfish.
eatdrink_accurateMake true
Make sure you have enough ingredients to complete before starting. Disable if you have a VERY slow computer, awesome if it works though.
eatdrink_autosellWhileRonin false
Makes you use much better stuff while in a run. This would happily use cranberry go-goo at a 100k mall value with a 500 meat Value of Adventure, so don't enable this if you're ever going to be selling stuff in the mall. Ever.
eatdrink_avoid_booze-soaked_cherry false
eatdrink_avoid_giant_marshmallow false
eatdrink_avoid_gin-soaked_blotter_paper false
eatdrink_avoid_sponge_cake false
eatdrink_avoid_wet_stew false
Various quest items. If I end up with these in my inventory and they're the best item, I'm happy using them. This isn't the default. You'll need to decide if you'd rather have better food or more adventures spent picking up the wet stew again, etc.
eatdrink_budget 10000
How much is the most a single item should be worth? You can set this to 50000 or higher if you're finding EatDrink is missing items that you'd want, but since I'm mostly ascending at the moment, 10k single item limit protects my rare holiday stuff from errant consumption.
eatdrink_considerCostWhenOwned true
If you set this to false, anything in inventory will be used regardless of value. Generally a bad thing, but amusing if you're planning on quitting and you're wanting to torment the G-D forums.
eatdrink_fav_pr0n_chow_mein true
eatdrink_fav_rockin'_wagon true
eatdrink_fav_twinkly_wad true
eatdrink_favUse false
Left these on defaults, but disabled the favUse, so it ignores them. This is where you'd set white canadians and spaghettis with skullheads for the trophies.
eatdrink_getBartender false
eatdrink_getChef false
If you have these set to true, mafia will try to make helpers for you automatically. I don't generally stay in aftercore long enough for it to matter, but if you're farming for any period of time, set them to true.
eatdrink_loopCount 3
How many times/steps should it go through looking for ingredients? More steps extends how long it runs, but also might get you slightly better food. During my testing, 3 got me supercocktails and so forth, which was good enough for me, but if you want it to craft hi-meins, you might need to put it up to 4 or 5.
eatdrink_make true
If this is set to false, it won't make food unless it's the best option, but it won't even consider creating food to be a possibility. That doesn't mean that mafia won't decide it's the best later, but that's on mafia then.
eatdrink_maxAge 2.0
If our mall prices are 2 hours or less, they're accurate enough. Anyways, mafia won't update older prices checked this session unless we buy them, so...
eatdrink_minimumAverage 1.0
If it doesn't give at least 1 adventure, don't consider it. This eliminates stat-only spleen items.
eatdrink_minimumQuality 1
If it doesn't have at least decent (>1 adventure) quality, eliminte the booze/food. This doesn't eliminate spleen, since they don't officially have quality.
eatdrink_ode true
We want ode if it's castable.
eatdrink_pause 0
Why wait 3 seconds repeatedly? I want it to run, now! :)
eatdrink_piePriority true
If I have a pie and no associated key, eat it first so I get the key.
eatdrink_priceFlexibility 1.25
Go up to 25% above known mall price maximum when retrieving the item.
eatdrink_priceOfNontradeables 999999999
eatdrink_priceOfQuestItems 10
eatdrink_priceOfUnknowns 999999999
If it's a rare or special item, keep it. If it's a quest item I'll be losing on ascension anyways, eat it immediately. Don't set it to 0 or 1, because that means it's skipped (probably), but 10 will make quest items first if it's any good.
eatdrink_simConsume false
eatdrink_simLevel 0
eatdrink_simRonin false
Normally I want to consume, not simulate. But if I'm simulating, use my actual level and ronin status.
eatdrink_stepMeat 20000
Don't spend more than 20k total for food, 20k total for booze, 20k total for spleen, and 20k total for overdrinking per day. This allows them to fill up, but avoids crazy-expensive stuff I really don't care about while mainly ascending, not farming. If you're farming and making good meat, set stepMeat to -1 and it won't cut off your meat spending.
eatdrink_suppressNoMilk true
eatdrink_suppressOverdrink true
If I run EatDrink in run, I know I'm not going to have milk. Don't ask me to confirm it. Same goes for ode... if I don't have enough meat to pay for ode in run, don't ask me to confirm it. Similarly, if I'm asking EatDrink to overdrink, I know I've told it to do that, I don't need another confirmation box.
eatdrink_valueOfNonPrimeStat 2
eatdrink_valueOfPrimeStat 10
Primestat is nice, but not really that important compared to adventures. It's better than regular stats though. If you're trying NOT to level up, set primestat to -1000 or something similar, and EatDrink will try to drop your primestat.

Those are the ones in the vars_<name>.txt file. In mafia's preferences themselves (General->Preferences) you should find:
Buy items from NPC stores whenever needed
If you are out of Ronin, pull items from storage whenever needed
Buy items with tokens at coin masters whenever needed
Buy items from the mall whenever needed
Take items from the closet whenever needed

Set anything you want to true. Only one I have disabled is taking items from the closet, because it leaves me with a way to keep safe items safe.

One more option... this one is in Item Manager->Creatable->Fine Tuning. Value of a turn spent crafting is the visible version of VALUE_OF_ADVENTURE that people talk about often, regarding EatDrink. Figure out how much a turn adventuring is worth to you and set it. This defaults to 500, but if the script is pulling in 2000 meat or more on average, you'll find yourself with significantly more turns if you set this to a more accurate number. I'm currently using 1250 here, because it gives me supercocktails while in-run without a box servant. It all depends on how much meat you'd like to spend and the quality of consumables you'd like to use.

Anyways, that's probably enough of an EatDrink tutorial for now. Yell if you have specific questions about other things and I'll try to clarify.

EDIT: copied to this thread by a Minion.
 
Last edited by a moderator:

slyz

Developer
I copied Theraze's "EatDrink tutorial" from another discussion. Should I link to it from the first post? If I do that, which version of ED should I attach to the first post? Or should I let Fronobulax manage that?
 

Winterbay

Active member
Code:
zlib eatdrink_daily_tangarita = true

In my vars_-file I have a lot of the above, 21 to be exact, with different foods, drinks and spleens. Any idea what they are or if I can just remove them?
 

fronobulax

Developer
Staff member
@Theraze - Thanks!

@ Slyz - I linked to it from the first post. Is that enough?

@Winterbay - You may delete them. I remember a long ago bug that loaded up your zLib file with what you had eaten as a potential favorite.
 

Theraze

Active member
Code:
zlib eatdrink_daily_tangarita = true

In my vars_-file I have a lot of the above, 21 to be exact, with different foods, drinks and spleens. Any idea what they are or if I can just remove them?

Remove them. Old EatDrink would check the price values of any item that you'd eaten every time, and only check historical prices on items under 2 hours on non-eaten items, despite that mafia won't get new prices if it's already checked once. The 21 items would be the items that you'd eaten with EatDrink below version 3.1 or so. Not a bug, but very bloated.

There are other legacy EatDrink settings that most people probably have set, like useStorage and so on... If I didn't mention it above, it's probably been depreciated and is now useless, because we employ retrieve_item which automatically uses mafia's properties, not our own settings for those.
 

garbled

New member
I've been mucking about with this script, and, yay, it rocks. One question though, sometimes I like to adventure in the sea, is there any way for it to key in on "Fishy" and make sure I get x turns of it?
 

Winterbay

Active member
I don't think so. I have a sushi-script (linked to in my signature) that can eat sushi for you, and calculate the potentially best one to eat but as far as I know EatDrink doesn't have this feature.
 

Theraze

Active member
Nope, no fishy or other effect support, but if you go get fishy yourself using the Sushi script, EatSushi, or any of the others (I'm pretty sure I have a third somewhere in my script folder, but I can't find it currently) and run EatDrink after, it will use whatever fullness and drunkenness you have left. Or if you're REALLY cheap, you can use one sake and 15 basic fish meat for 225 turns of fishy, then let EatDrink fill up your drunkenness and spleen...
 
Top