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

fronobulax

Developer
Staff member
I added, circa the try in getitem, the following:
Code:
print(initialvalue);
print(PRICE_FLEXIBILITY);
print(it);
print(mall_price(it));
print(floor(mall_price(it) * PRICE_FLEXIBILITY));
    set_property("autoBuyPriceLimit", max((initialvalue >= 1000 ? 1000 : 0), min(initialvalue * PRICE_FLEXIBILITY, floor(mall_price(it) * PRICE_FLEXIBILITY))));
print(get_property("autoBuyPriceLimit"));

The output, trying to overdrink, is
At drunkenness of 19. Overdrinking with 10000 meat.
Getting 1 sangria del diablo in 3 seconds
Countdown: 3 seconds...
Countdown: 2 seconds...
Countdown: 1 second...
Waiting completed.
20000
1.25
sangria del diablo
-1
-2
autoBuyPriceLimit => 1000.0
1000.0
Verifying ingredients for sangria del diablo (1)...
Searching for "sangria"...
Search complete.
Stopped purchasing sangria @ 1,050.
You need 1 more sangria to continue.
autoBuyPriceLimit => 20000
Something went wrong with getting sangria del diablo for 2240. Recalculating.

I have no idea why mall_price would be negative but my guess is because there are not any sangria del diablo for sale at the moment and there is a discrepancy between the wiki and the code. I am definitely logged in at the moment so if the wiki is right it should be zero. Given that mall_price could return 0 it might be worth rethinking this bit of logic.
 

Theraze

Active member
Well, the effective price bit is supposed consider the price to purchase sangria del diablo as the price of 2 cherries and a boxed wine... maybe that isn't happening properly. Try this version and see if it works better? Haven't tested it, but... should work. :D Passes the price requested in getone to getitem instead of recalculating... that should make it properly use the effective price instead of always using mall_price.
 

Attachments

  • EatDrink.ash
    93.9 KB · Views: 76

Theraze

Active member
Excellent. Been using it in fistcore and enjoying the fact that it doesn't keep sucking away my slight amounts of meat. At some point here I'll have to dump my Rinn quest scripts with fistcore modifications on dropbox. Eh, soon. Ish. :) Anyways, let me know if we find any new bugs. Believe that was the only true bug we were aware of...

Edit: Did find/fix a bug in get_accordion... if you have it set to auto-upgrade to RnRL, and it fails to create for some reason, it used to consider that as having no accordion at all. Now it will still use your stolen accordion or whatever you have, so... that's an improvement. :) Though you probably won't have enough mp to cast if you don't have the 100 meat for the hermit pass. :)
 
Last edited:

Banana Lord

Member
Currently I provide a link to ED in my Harvest.ash thread, but I note that the version in the first post in this thread hasn't been updated for a while, and a user who posted in my thread seems to be having issues with that version of ED (not filing organs as much as it should). Which post would you advise me to link to for users to download ED?
 

Theraze

Active member
Whatever the latest one is... currently 1182. The 1158 one has issues with TPS and KLP creation prices. The 1182 one will tell it when getting the item how much it wants to spend instead of checking mall_price again. This also potentially speeds things up a bit, if you were using historic prices. And trust HP.

That being said, there should be another update in the next few days if we can figure out why mafia loves to prefer buying new clovers from the hermit over reconstituting the disassembled clover in my inventory. It's not directly related to the bugs I fixed in ED since the 1182 post, but it is somewhat affected by the fixes, so...
 

fronobulax

Developer
Staff member
Basically there was a mafia change after 14.7 was released that broke ED. The version in 1025 should be used by anyone who is running r9599 but wants the ED functionality of the beginning post. Anyone who wants the latest and greatest and is running a new enough version of mafia should use the version Theraze noted above. Bottom line is there are currently three different versions of ED and which one is appropriate depends upon the mafia version and functionality desired. ED will get back to one version once mafia 14.8 is released which might be "soon" depending upon September's IOTM.
 

jwylot

Member
Will the version in post 1182 fix my sauceror eating without milk these days?

PHP:
autoBuyPriceLimit => 20000
Searching for "milk of magnesium"...
Search complete.
Getting 1 milk of magnesium in 0 seconds
autoBuyPriceLimit => 1218.0
Searching for "scrumptious reagent"...
Search complete.
Verifying ingredients for milk of magnesium (1)...
Searching for "glass of goat's milk"...
Search complete.
Stopped purchasing glass of goat's milk @ 1,890.
Using cached search results for glass of goat's milk...
Stopped purchasing glass of goat's milk @ 1,890.
You need 1 more glass of goat's milk to continue.
 

jwylot

Member
lol.....being computer illiterate, I'm never too sure what information will help. I'll turn up verbosity tomorrow.
 

Theraze

Active member
My guess is that it might have to do with jason's tweak to retrieve_item to make it reconsider costs, and having it decide that it's cheaper to make 3 milks than to buy one, if you're currently a sauceror... But that's speculation based on:
a) Milk creating 3 for saucerors
b) New retrieve_item considering the triple-item cost
c) You being a sauceror

Any of those three not the case, then that explanation all falls down. :) You could currently raise your price flexibility, but that's a hack fix.
 

fronobulax

Developer
Staff member
Will the version in post 1182 fix my sauceror eating without milk these days?

PHP:
autoBuyPriceLimit => 20000
Searching for "milk of magnesium"...
Search complete.
Getting 1 milk of magnesium in 0 seconds
autoBuyPriceLimit => 1218.0
Searching for "scrumptious reagent"...
Search complete.
Verifying ingredients for milk of magnesium (1)...
Searching for "glass of goat's milk"...
Search complete.
Stopped purchasing glass of goat's milk @ 1,890.
Using cached search results for glass of goat's milk...
Stopped purchasing glass of goat's milk @ 1,890.
You need 1 more glass of goat's milk to continue.

It is unable to get the milk for the price it expects. This may be a function of your settings or it may be the same issue I was having with cherries and sangria in which case it is fixed in 1189 (which is presently the release candidate once mafia gets to 14.8).
 

jwylot

Member
Hmmm I get the same result with the 1182 version. I haven't changed any settings and it used to work so I'm thinking the recent changes to mafia's acquire logic are the cause. Anyway, I just stocked up on milk for now.
 

Theraze

Active member
Okay... so the problem here is that with the change to retrieve_item, it may try to get items that aren't actually possible anymore on the basis that, if it were possible, it would be cheaper. It's similar to some of the price advisor weirdness... it suggests spending 10 million meat on your 5000 value item because you'll sell it for 11 million. Course, that only works if someone actually buys it, and in the mean time you're out 10 million meat, but... so it goes. :)

We have a much smaller scale of this... we're allowing a maximum of 1218 meat for buying a milk of magnesium. It decides that it would be more efficient to buy a goat milk and make it instead, except that we can't buy a goat milk for 1218 meat. We're spending twice our meat value to get 3* the results... but it means we'd need our default flexibility to be 250% or even 300% to be able to avoid problems. Or, retrieve_item would need to respect the autoBuyPriceLimit and consider what it can actually get for that.

I'd suggest just removing the setting of aBPL we do... except that it wouldn't fix the underlying problem, which is that if mafia decides that we can get more of something for more meat then we've budgetted, we're still ending up over budget. And the diet suffers.

Thoughts?
 

fronobulax

Developer
Staff member
Thanks for the analysis. I'll ponder. It almost sounds like the ideal solution would be to force retrieve_item to restrict its options based upon a budget but whether that is a mafia FR, an ash function or just a kludge of closeting meat before the call, is to be determined.
 

Winterbay

Active member
I wonder if it would be possible to set the new setting valueOfInventory to something for the run of the script in order to force it to buy one if it fails to create one but could still buy one?
 

Theraze

Active member
Changing mafia settings is something I'd prefer not to do unless there's a good reason for it... We change aBPL because it's the only good way, besides closetting and withdrawing meat on every step, to purchase an item on a budget. If we want to trust that it's going to buy properly? If so, we can remove the whole aBPL setting and that would fix these... but we have no guarantees that it will succeed in its later items, if it overspends early on.

Regardless, I should report this as a bug, since retrieve_item would have worked on the original aBPL and fails only due to recalculating the 'cheapest' way to get there as spending more money.
 

Bale

Minion
Changing mafia settings is something I'd prefer not to do unless there's a good reason for it... We change aBPL because it's the only good way, besides closetting and withdrawing meat on every step, to purchase an item on a budget. If we want to trust that it's going to buy properly? If so, we can remove the whole aBPL setting and that would fix these... but we have no guarantees that it will succeed in its later items, if it overspends early on.

I admit that I don't follow the development here very closely, but why is aBPL the only good way to purchase an item on a budget? Why don't you use the three parameter version of buy()? I assume there's a reason, but I'd appreciate it if you would tell me that reason.
 

fronobulax

Developer
Staff member
The basic issue, and I may get this entirely wrong or put words into Theraze's mouth that don't belong, but EatDrink has been migrating towards using native mafia features rather than implement duplicate functionality in ash. EatDrink also aspires to honor a contract with the user that whatever it does will not exceed certain limits. A concern is that acquire will use all of the native mafia functionality but at the moment EatDrink is not aware of how acquire will accomplish its actions. Before the recent changes to the acquisition logic, EatDrink used the autoBuyPriceLimit to enforce the 'contract' for amount of meat spent. The recent changes "broke" that and since mafia changed, not EatDrink, it is at least reasonable to ask whether mafia should change again.

All that aside, I have a vague recollection that a speculative version of acquire is available and if that is true then the preferred solution would be to convert EatDrink to speculate to figure out how something is going to be accomplished and budget accordingly.

The three parameter version of buy is not helpful until EatDrink knows what mafia thinks the best way to obtain something is. EatDrink does not want to buy milk on a budget if if can buy the components and make it for less.

YMMV.
 
Top