how do i remove cached search results

I'm getting this infinite loop using Universal Recovery, but I don't think it's a bug with UR:

Restoring MP! Currently at 283 of 283 HP, 37 of 217 MP, current meat: 15046263 ... Target MP = 163.
Searching for "phonics down"...
Search complete.
Purchasing phonics down (3 @ 230)...
Stopped purchasing phonics down @ 454.
Using cached search results for phonics down...
Purchasing phonics down (3 @ 230)...
Stopped purchasing phonics down @ 454.
Using cached search results for phonics down...
Purchasing phonics down (3 @ 230)...
Stopped purchasing phonics down @ 454.

Step one for me would be to try to remove the cached results and try again. How do I do that?
 

Theraze

Active member
The cached results it's using are from UR's cached results. Abort automation and heal up, and it should take fresh data again. But it's a bug with UR trying to purchase after failure, not a bug with mafia and prices.
 
Abort automation and heal up, and it should take fresh data again.

I've done this a few times with no luck. Aborted automated healing, even manually bought phonics downs from the mall to try to re-teach the session the "current price" of them, but as soon as I ran out of the purchased phonics ran into the same problem. exited mafia entirely and restarted it up, no help. maybe i'll move the inquiry to the UR thread if I can't get it working.

Thanks.
 

Winterbay

Active member
Or do what I did, launch the relay browser and buy 5 or so of the thing it's trying to buy. That will a) let UR carry on and b) update the cached price.

edit: the problem is the person selling cheapest is having a limit of 5 which confuses Mafiua. I think.
 

fronobulax

Developer
Staff member
edit: the problem is the person selling cheapest is having a limit of 5 which confuses Mafiua. I think.

Not sure I would point all the fingers at mafia. The problem is that mafia returns a mall price, period. There are, however, circumstances when a player cannot actually make a successful purchase at that price. Many scripters assume that they can always make a purchase at the reported mall price which is not true, but that is not an error condition that is often checked for. While there are many possible ways to address this in mafia, most of them can be abused to create mall bot type functionality. So I suspect that the problem of quantity limited sales and reported prices will remain.

I seem to recall a discussion about cached results and being told that buying from the Purchases tab did not update the cache but using the CLI did. I am not certain I have remembered correctly or that this is still true but just buying something is not sufficient to re-validate the cache.
 

Theraze

Active member
Well, the bug is that when a purchase fails, UR is supposed to mark that item as failed and move on to something else. Unfortunately, that part of the script isn't currently working, so we end up with infinite loops or trying to purchase items for way more than we wanted to.

Edit: Old post where HasteBro purchased 12 palm fans at 74k each before UR actually stopped at aBPL...
 
Last edited:
Well, the bug is that when a purchase fails, UR is supposed to mark that item as failed and move on to something else. Unfortunately, that part of the script isn't currently working, so we end up with infinite loops or trying to purchase items for way more than we wanted to.

Edit: Old post where HasteBro purchased 12 palm fans at 74k each before UR actually stopped at aBPL...

ahh ok, thanks for the heads up. here i assumed it wasnt a UR bug, and it turns out it is. I assume Bale is aware, so I'll just try to manually circumvent this one for the time being.
 

Winterbay

Active member
I seem to recall a discussion about cached results and being told that buying from the Purchases tab did not update the cache but using the CLI did. I am not certain I have remembered correctly or that this is still true but just buying something is not sufficient to re-validate the cache.

Yeah, the problem there being that you can't buy anything via the CLI while a script is running and so you will have to abort automation (while you can buy stuff form the relay browser, hopefully that will work as well?).
 

Theraze

Active member
The purchase cost is getting updated just fine. The problem is that UR isn't deciding that it needs to reconsider which item to buy when the price goes too high. EatDrink used to have specific code (that I added) in where I'd cache mall_price before a purchase and if that purchase failed and mall_price stayed the same, add the item to the "skip, don't use this anymore this execution of EatDrink" list (which already existed, but hadn't been adding items in that way before).

The easy-ish way to do it in UR would be to remove items from the restorative_info[item] map (named heal) if they fail the purchase per above check. Should take ~15 minutes to get in without any UR editing knowledge. With planning, the easy fix would just be checking price, post-failure in the purchase function. If it failed, and price stayed the same (note that MMJ and herbs have a price of 100), remove that item. Easy.

Sample code which SHOULD work without appreciably slowing things. This code goes into the purchase function near the end, just before the return false; that finishes it up. Note that I did include the return true and return false that surround the price check, for clarity.
Code:
	if(buy(q- for_use(it), it, min(ceil(price*1.25),get_property("autoBuyPriceLimit").to_int())) > 0 || for_use(it) > 0)
		return true; 	// for_use() needs to be checked both before and after that purchase ;)
	if(price == ($items[magical mystery juice, Medicinal Herb's medicinal herbs] contains it ? 100 : historical_price(it)))
		remove heal[it];
	return false;
 
Last edited:
Top