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

Ranrar

New member
Just a little user side feedback,

Please remove the moderator update in red and replace it with a statement about how to set valueofAdventure.

I often find myself hunting for how to change valueOfAdventure, so please leave that data in the first post.

Next up, following dummy logic, you hit the eatdrink thread, go to fronobulax's old thread, get redirected back to the original, (but wait i thought the point was fronobulax didn't have control of the original thread), (o, hey, wait, he does), (oooo I get it)...

Anyway, please kill that moderator update. It's just needlessly confusing.

Thanks for picking up the ball on eatdrink,
Ranrar
 
Last edited:

Winterbay

Active member
The fact that there no longer is an eatdrink_modified makes it a bit confusing that the first post refers to one I'd say.
 

fronobulax

Developer
Staff member
Fixed again. I edited the first page a couple of hours ago but what I thought I had changed and what actually got saved were different.
 

Ferdawoon

Member
Just curious but what happened to the auto-usage of Milk of Magnesium?
The script used to go get a Milk of Magnesium from the Mall, but now even when I got some in my inventory it still prompt me if I am sure that I want to eat without it.
 
Last edited:

fronobulax

Developer
Staff member
@Theraze - I give up. Next time you post the mods that eliminate the setting of the eatdrink_daily variables I will include them. For extra credit you could add a snippet that would automagically delete them via zLib if they exist :)

@Ferdawoon - I have one character that is having issues with drinking milk and one that doesn't seem to be. I have been reluctant to figure out why, but now that you are also seeing it, this is on the top of my list. Thanks.
 

Theraze

Active member
Okay... hopefully these should meet with your desires. Hopefully. :)

EatDrink attached here has no eatdrink_daily_+item additives. It checks any item that's out of date for pricing, not just the ones you've eaten in the past. This uses the historical pricing, so it should only hit once regardless of how many characters you use. Also, if it hits too often for you, just increase its age check. I've left it at the default currently, which is over 2 days, I believe. As well, this EatDrink avoids $item[none] instead of Genalen Bottles, since anything that's $item[none] can't be created through ASH, and needs to be created in CLI instead. Think those are the only changes I actually have that aren't in 3.1.1 currently.

RemoveDailyEatDrink SHOULD parse through your zlib keys and remove any legacy eatdrink_daily_+item values. I've given it a simulate_only boolean, so you can see what it will do before it does it. If run with simulate on, it should parse through your list, giving each eatdrink_daily_+item var it finds, and then give you a count of how many it found total at the end. If you have simulate off, it should remove the values as it parses through them, and after giving the count, update_vars to save the changes as long as removalcount is greater than 0. I believe that it should work, but I couldn't find any similar scripts to validate from, and I haven't had any _daily_ values for several months, plus I've overdrunk on all my characters, so...
 

Attachments

  • EatDrink.ash
    60 KB · Views: 24
Last edited:

fronobulax

Developer
Staff member
Theraze's removal script above does not quite work "out of the box" but I have attached a corrected version that worked for me. Thank you Theraze, since it was more fun, and less work, fixing syntax errors than editing the data files directly.

I threw in some diagnostics and EatDrink handled milk as expected. It failed to drink with a poor character but was clear that it was trying to obtain milk and could not. The rich character that had the problem did not have it today. I'll ponder for one more consumption cycle and post Theraze's update as 3.1.2.
 

Attachments

  • RemoveDailyEatDrink.ash
    528 bytes · Views: 23

fronobulax

Developer
Staff member
Double post, but different subject, so I don't care. I'm throwing a few things out to see whether the thumbs go up or down or I just hear crickets.

At some point I was seriously into rewriting EatDrink's functionality so that I understood it and could explain what it did.

Eatdrink reads mafia data files and does a fair amount of processing on them. However, it appears that the new .proxy feature could eliminate this requirement so I am pondering whether my limited attention span might be better spent converting Eatdrink to use the .proxy.

Eatdrink has had some interesting interactions with Bale's UR in cases where the amount of meat is currently constrained. Basically, Eatdrink decides it needs to cast Ode. Something, which I believe is UR based upon my settings, then tries to recover enough MP to actually do the cast. It fails and aborts in a way that control is never returned to Eatdrink. I'm not sure that is working the way I would like.

My knee jerk response is that I want Ode/Milk settings. Each has three values.
  • Never use Ode/Milk and never tell me it is not being used.
  • Always use Ode/Milk and abort if it is not available.
  • Try and use Ode/Milk but if it cannot be obtained then continue without it.

I see the first being useful during meat shortages, ronin, and non-speed HC runs. I see the second being useful in aftercore and times where automation is not a major goal. I see the third as the most likely value for typical users.

Eatdrink understands about boxen but with the fancy cooking equipment now implemented in KoL it is definitely trying to make things that it cannot. I am also not sure the repair detection functionality in Eatdrink is really appropriate. If Eatdrink can spend meat to repair boxen then should it not also buy the fancy equipment?
 

Theraze

Active member
Hmm... mine has always been fancy cooking aware. If I don't have the fancy cooking gear, the creatable amount is 0, so it doesn't try to create it. Might still buy it if I have mall access and that's cheaper, but it won't try to create. What kind of stuff is yours trying to create that it can't do?

Also, the value that you might want to set into UR might be this one:
baleUr_AlwaysContinue=true
because if that one isn't set, UR will throw an abort if it's not able to restore fully. The hack-ish thing to do would be to check if UR is active as the recovery script, check if UR AC is on, and if not, enable it while the script is running. Hack-ish though, because it's overriding the user's ability to choose that they want the script to stop and let them actually restore as much as they want, and if it can't restore enough mp for paying for ode, your actual drinking is likely to be very poor choices, especially after the restoration has sucked your meat dry.

The part that I'd most like to have implemented into EatDrink is the consumeLast bit. This would take ED actually being aware of how many items it's going to consume instead of just looping until it errors, and some other nice things like that. Would also save a cast when working with fancy drinks and ode.

And yes, once it's fully implemented for consumables, definitely should switch to proxy records. Shouldn't be difficult to do, hopefully...

Theraze's removal script above does not quite work "out of the box" but I have attached a corrected version that worked for me. Thank you Theraze, since it was more fun, and less work, fixing syntax errors than editing the data files directly.

I threw in some diagnostics and EatDrink handled milk as expected. It failed to drink with a poor character but was clear that it was trying to obtain milk and could not. The rich character that had the problem did not have it today. I'll ponder for one more consumption cycle and post Theraze's update as 3.1.2.

Moral of the story, validate works even when you can't run the script. :D That would have fixed the contains_text screwup. Heh. Anyways, removed my copy from 728, since it doesn't work. Anyone needs it, use fronobulax's fixed copy from 729. :D
 
Last edited:

fronobulax

Developer
Staff member
I had half of a long response just get eaten :-( This will consequently be somewhat terse.

I'll pay real close attention to the fancy stuff next time I have someone ascend. I think what I am really asking is for an option to buy and install the items if they are needed and not present, in much the same way boxen are pulled, purchased, made or repaired.

baleUr_AlwaysContinue was implemented at my request ;-) I think part of the problem is that Eatdrink doesn't even know UR is being invoked because it is a side effect of restoring MP in order to cast Ode.

I considered something like ConsumeLast when looking at an Integer Programming formulation of the EatDrink optimization problem but that is a lot of work. Basically there are cases where selecting the best currently available is NOT optimal if there are multiple selections and constraints. Given that, there is really no major benefit to ConsumeLast at least as far as I can figure. Easier management of Ode is not a major benefit, IMO.
 

Theraze

Active member
The benefit to ConsumeLast is when you're using fancy cooking inside a HC run, when you don't have boxen. As it stands, you currently use 1-4 casts of ode (giving you 20 adventures worth). If you craft 3 fancy drinks based on your 3 casts, that takes 3 adventures... one of which happens before the first consume. That means it will take 21 adventures of ode to actually consume your 19 drunkenness. If you can do 5 casts, that will probably end up soaking 4 adventures before it runs out, 3 of which happen while ode is active, meaning you'll need 22 adventures of ode.

Same goes for milk. It drinks the milk when the first item is done, so if you only have 1 fancy food item, you'll be fine. But if you keep doing key lime or something else similar...

The ode/milk use crafting of fancies without boxen/Inigo is why I think it's still a useful eventual aspect.
 

Bale

Minion
Eatdrink reads mafia data files and does a fair amount of processing on them. However, it appears that the new .proxy feature could eliminate this requirement so I am pondering whether my limited attention span might be better spent converting Eatdrink to use the .proxy.

Only if adventure & stat gain ranges are also added as proxy fields. Otherwise you'd still need to file_to_map() and it isn't worth the trouble.


Eatdrink has had some interesting interactions with Bale's UR in cases where the amount of meat is currently constrained. Basically, Eatdrink decides it needs to cast Ode. Something, which I believe is UR based upon my settings, then tries to recover enough MP to actually do the cast. It fails and aborts in a way that control is never returned to Eatdrink. I'm not sure that is working the way I would like.

I think you'd best check my_mp() and my_maxmp() before casting Ode. If it is less than 50, set baleUr_AlwaysContinue and call restore_mp(mp_cost($skill[ode to booze])). Then check my_mp() again before daring to cast Ode and reset baleUr_AlwaysContinue to its prior value. If the second MP check fails, then don't cast Ode.
 
Last edited:

fronobulax

Developer
Staff member
It would appear that r9199 has introduced a feature that breaks EatDrink. Either do not update to r9199 or see the thread here for a workaround.
 

Galanodel

Member
New bug

9201 freezes if you do any calls to the server while the script is running (like opening your inventory in mafia).

Also, I am interested in reducing the wait time on the script to 1 second. I tried editing it in the script, but it stayed at 3 seconds. Am I missing something?
 
Last edited:

Theraze

Active member
With zlib variables, changing it in the script doesn't affect your data files. Change the pause in your vars_Galanodel (or whatever character name) to 1 instead of 3. Or use a zlib relay editor. Those are nice too. :)

9201 freezing probably wouldn't be an EatDrink bug, but a mafia bug... most likely. :)
 

fronobulax

Developer
Staff member
3.1.2 has Theraze's change to stop saving daily preferences.

I was unable to reproduce my problem with milk so I'm not going to wait to fix it.

As noted above mafia's hiccup with data files has been fixed so script should behave again.

@Galanodel - More information, please. I can't reproduce the behavior and I do run EatDrink while doing other things with mafia. I doubt it is an EatDrink specific problem but if reproducible it should be looked at. Note that there used to be a whole lot of "freezing" issues with multiple windows and server hits in general but there were believed to be due to some deadlock issues with Swing threads that were since fixed. That isn't supposed to make sense unless you speak Java.
 

Galanodel

Member
3.1.2 has Theraze's change to stop saving daily preferences.

I was unable to reproduce my problem with milk so I'm not going to wait to fix it.

As noted above mafia's hiccup with data files has been fixed so script should behave again.

@Galanodel - More information, please. I can't reproduce the behavior and I do run EatDrink while doing other things with mafia. I doubt it is an EatDrink specific problem but if reproducible it should be looked at. Note that there used to be a whole lot of "freezing" issues with multiple windows and server hits in general but there were believed to be due to some deadlock issues with Swing threads that were since fixed. That isn't supposed to make sense unless you speak Java.


The freezing problems appears to have been an overall Mafia issue, so I wouldn't waste development time on it.

Thanks for the info on the vars file, I'll take care of it now :D
 
Top