Bug - Fixed New acquire will try to purchase items over autoBuyPriceLimit

Theraze

Active member
If mafia decides it can make an item for cheaper than the purchase price, it will try. This is awesome, except that it can, in some cases, spend more to save money then the autoBuyPriceLimit actually allows. For example, with an aBPL set below 1300, retrieve_item on milk of magnesium as a sauceror with SR in inventory will fail due to not being able to buy goat milk. Example:
PHP:
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.
The end result would have been 3 milks for ~630 instead of costing ~975 each, so that is nice. Problem is that it fails to complete.
 

jasonharper

Developer
So what are you suggesting be done to fix this? autoBuyPriceLimit is doing exactly what it's supposed to do here.
 

Bale

Minion
Just a second... The problem is that if you set autoBuyPriceLimit to 1218, then it will refuse to purchase a glass of goat's milk that costs 1890? That sounds like a successful feature, not a bug.

Perhaps the problem is that EatDrink shouldn't make use of autoBuyPriceLimit in that way. Please explain why this is a mafia bug instead of an EatDrink bug.
 

heeheehee

Developer
Staff member
I think that the issue is that it's failing to acquire the item because of this limit, and it doesn't fall back to other options.
 

Theraze

Active member
Hmmm... the way I'd expect it to run would be to only suggest purchasing items that are actually possible under the aBPL. If that means a less efficient purchase that actually works, then that seems like it should succeed in doing that.

Alternatively, a three parameter speculative retrieve_item would work. We'd need it to return adventures used, meat spent, items retrieved (since the issue is that we're getting 3 when we only want/need 1 at the moment), items used to retrieve that item, etc. That should make us able to actually plan retrieving multiple items accurately again.

I love the fact that mafia is smarter. I'd just like to be able to use it to plan more than one retrieval out, even if I'm meat-poor.
 

Winterbay

Active member
Even though the result is cheaper (since I get three for the price of one) if I only have enough meat to buy one (and a limit close to my meat) I think it's a bit odd that it still tries to buy the more expensive one (which is a price above my limit) and then fails completely when it can't due to not having enough meat.
 

slyz

Developer
I guess the ASH retrieve_item() function could have an equivalent to the CLI "acquire?" command that calls simRetrieveItem. It could be:
Code:
string sim_retrieve_item( int, item )
but I think the behavior of retrieveItem() when sim is true should be reviewed. Right now it will generally return "create or buy" depending on the various autoSatisfy preferences and if the character is able to create the item. It won't tell you if creating is cheaper than buying, or if the autoBuyPriceLimit will prevent the retrieval.

EDIT: why not just check the return value of retrieve_item(), and remove the item as an option if it's false? Or simply warn the user and stop the script? Since autoBuyPriceLimit is a way for the user to control what scripts (or Mafia) can spend on an item, let him deal with the consequences of a failure.
 
Last edited:

Theraze

Active member
Is this in reference to my initial question, or something else? If it's in response to my initial question, the issue is that it IS possible to acquire the item under the autoBuyPriceLimit, but because mafia wants to 'upgrade' the retrieval to get more than I asked for, it isn't possible anymore.

My request: possible.
The mafia modified amount I didn't request: not possible.

What I was asking for is, if it's possible to get what I asked for, do it. It may not be as economical as the 'best' option, but I'd rather it worked than failed.
 

roippi

Developer
I think the issue in the OP is more or less exclusive to the acquiring-reagent-potions-as-sauceror case?
 

Theraze

Active member
Believe so. Not sure of any other cases where you can craft multiple instead of single in varying cases... there might be some MUSE/SUSE item that has similar behaviour, but Sauceror is the standard example that I was experiencing.
 
Top