Universal Recovery Script

Theraze

Active member
If UR uses buy(quantity, item) then that's an explicit action that ignores aBPL. If it uses retrieve_item then that will respect aBPL...

One more note. If it uses buy(quantity, item, price) - I think that's the order of the three - then it will spend up the the price per item, but not go above it.

Guessing though that UR uses the 2-parameter buy, which will spend as much as needed to acquire that item, if it's in any way possible, even if it's cheaper to buy component items and convert them or something similar, which is why I love retrieve_item since jason's awesome changes. :)
 

roippi

Developer
Yeah, something should be done to allow observance of aBPL. I'll wait for bale to comment since I'm unfamiliar with UR's innards.
 

zarqon

Well-known member
Seems like it if it's using the two-parameter version it could use the three-parameter version, where the price limit would be set programatically to the point at which another option became more profitable.
 

Theraze

Active member
I find 3 different retrieval methods (quickly) in UR.
Purchase uses the 3 parameter buy, including a 25% bump on historical_price, similar to what EatDrink used to use.
Medicinal herbs and antidotes use 2 parameter buy, since their prices are fixed.
The VIP key uses retrieve_item if available_amount > 1 and item_amount == 0.

The problem is that item_price considers historical_price to be good if it's less than an hour and a half old, and since UR might use up a LOT of restoratives, that's not necessarily true. Unfortunately, it seems like your best solution might just be to comment out the lines regarding historical_age and historical_price from item_price, and let it always use mall_price. It means checking the price once, but after that it will always use the price from your last purchase instead of the price from when it checked an hour and a half ago...
 

Bale

Minion
Theraze, your answer sounds like nonsense to me. historical_price() is updated by purchasing, just as mall_price() is updated. the only difference is the starting condition which will not be updated from the beginning of the session in either case.
 

Theraze

Active member
Okay... so what's the reason why UR decided to buy 12 palm-frond fans at 74k each then, after using 119 fans at <1k? If UR doesn't update its 'best choice' list when purchases fail, that seems to be a major bug...
 

HasteBro

Member
Still, my real question is... why is UR buying things when I have it set up to use inventory items first AND I have 10k MMJs in my inventory? I actually have exactly 13337 MP restorers, according to the buffbot manager. Also, I'm a level 41 AT, so MMJs should be my main restorer anyway.

I'm attaching a debug log for a "restore mp" CLI command, in case anyone wants to take a look.
 

Attachments

  • DEBUG_20120307.zip
    97.9 KB · Views: 54

slyz

Developer
Instead of a debug log, could you set UR to a higher verbosity, restore, and copy/paste the gCLI output here?
 

HasteBro

Member
Verbosity 2, 5 and 1 respectively. I see no difference at all. I was supposed to alter "baleUr_Verbosity" right?

Code:
> restore mp

Restoring MP! Currently at 7113 of 7113 HP, 21694 of 23705 MP, current meat: 7148523 ... Target MP = 22520.
Searching for "palm-frond fan"...
Search complete.
Purchasing palm-frond fan (21 @ 324)...
You acquire palm-frond fan (21)
Purchases complete.
Using 21 palm-frond fan...
You gain 855 hit points
You gain 861 Mojo Points
Finished using 21 palm-frond fan.

> restore mp

Restoring MP! Currently at 7113 of 7113 HP, 22555 of 23705 MP, current meat: 7141719 ... Target MP = 22556.
Searching for "palm-frond fan"...
Search complete.
Purchasing palm-frond fan (1 @ 324)...
You acquire an item: palm-frond fan
Purchases complete.
Using 1 palm-frond fan...
You gain 39 hit points
You gain 35 Mojo Points
Finished using 1 palm-frond fan.

> restore mp

Restoring MP! Currently at 7113 of 7113 HP, 22590 of 23705 MP, current meat: 7141395 ... Target MP = 22591.
Searching for "palm-frond fan"...
Search complete.
Purchasing palm-frond fan (1 @ 324)...
You acquire an item: palm-frond fan
Purchases complete.
Using 1 palm-frond fan...
You gain 42 hit points
You gain 39 Mojo Points
Finished using 1 palm-frond fan.
 

icefall5

Member
I just got this error:
Beaten Up will be removed by ongue [sic] of the Otter...
You don't have a skill uniquely matching "Tongue of the Otter"
Autorecovery failed.

Autorecovery failed.

I manually healed myself (using scroll of drastic healing), and it continues to give me this error - I cannot adventure at all. I receive the same error after closing and reopening mafia. I also tried forcing an adventure through the relay browser, and, while I could adventure that way, trying to adventure using the GUI after that still results in the same error. I am a Seal Clubber, but I do not have Tongue of the Otter. I'm on r10744, the current version as of this post.
 

Theraze

Active member
For curiosity's sake, check if Auto remove malignant effects is on? That's in the mafia preferences, not UR. If it is, turn on debug logging (Help->Start Debug Log), try to adventure so it gets the error, turn off debug logging, and post it as a mafia bug. One of the developers, hola, has been working some with fixing the malignant effects, but it's been resistant. Maybe your log will help him find the solution.

For curiosity's sake though... are you in a HC (or in-ronin) run currently? Do you have Tongue of the Otter as a permanent spell normally?
 

goom

New member
i continue to encounter a loop

Restoring MP! Currently at 159 of 288 HP, 6 of 218 MP, current meat: 16132 ... Target MP = 218.
Searching for "six-pack of New Cloaca-Cola"...
Search complete.
Stopped purchasing six-pack of New Cloaca-Cola @ 20,100.
Using cached search results for six-pack of New Cloaca-Cola...
Stopped purchasing six-pack of New Cloaca-Cola @ 20,100.
You need 2 more six-pack of New Cloaca-Cola to continue.
Using cached search results for six-pack of New Cloaca-Cola...
Stopped purchasing six-pack of New Cloaca-Cola @ 20,100.
Using cached search results for six-pack of New Cloaca-Cola...
Stopped purchasing six-pack of New Cloaca-Cola @ 20,100.
You need 2 more six-pack of New Cloaca-Cola to continue.
Using cached search results for six-pack of New Cloaca-Cola...
Stopped purchasing six-pack of New Cloaca-Cola @ 20,100.
Using cached search results for six-pack of New Cloaca-Cola...
Stopped purchasing six-pack of New Cloaca-Cola @ 20,100.
You need 2 more six-pack of New Cloaca-Cola to continue.
Using cached search results for six-pack of New Cloaca-Cola...
KoLmafia declares world peace.

what did i set wrong?
 

Theraze

Active member
UR wants to use all 6 cans from a six pack, but you have one broken already, which makes it confused because it's a little bit silly (in a very expensive way). Closet your new cloaca-colas and UR will move on. :)
 

icefall5

Member
For curiosity's sake, check if Auto remove malignant effects is on? That's in the mafia preferences, not UR. If it is, turn on debug logging (Help->Start Debug Log), try to adventure so it gets the error, turn off debug logging, and post it as a mafia bug. One of the developers, hola, has been working some with fixing the malignant effects, but it's been resistant. Maybe your log will help him find the solution.

For curiosity's sake though... are you in a HC (or in-ronin) run currently? Do you have Tongue of the Otter as a permanent spell normally?
Disabling the malignant effects checkbox did fix the problem. It did say, however, that I had Beaten Up and thus healed me before my first adventure, thereby wasting a hot tub visit for the day, even though I had ~60% HP (I don't have it healing until 15%), and I did not have Beaten Up. I am not in a special run, and I do not normally have TotO (I don't know if I've ever gotten it).

EDIT: It just started doing it again, but the log doesn't include much at all; pretty much what I posted. The debug is attached, and I've submitted it as a bug, as the problem persists even when removing UR.
 

Attachments

  • DEBUG_20120309.txt
    1.2 KB · Views: 39
Last edited:

Theraze

Active member
Looks like, for some reason, the part of UneffectRequest.java that turns
PHP:
		removableEffects = new HashSet();
		skillRemoveMap.put( "cast Tongue of the Otter", removableEffects );
		removableEffects.add( "Beaten Up" );
into a skill
PHP:
		if ( action.startsWith( "cast " ) )
		{
			String skillName = action.substring( 5 );

			if ( !KoLCharacter.hasSkill( skillName ) )
			{
				action = "";
			}
		}
is pulling off an extra character, turning tongue of the otter into ongue of the otter. Anytime you don't have the skill, which should happen if the skill name becomes malformed as is evidenced in your debug log, it's supposed to disable it as a valid recovery option... but isn't, for some reason. Definitely looks like a mafia bug, but it'd take someone with more Java chops than me to figure out how "c[0]a[1]s[2]t[3] [4]T[5]o[6]ngue".substring(5) starts at the o, character 6, instead of the T, character 5. My read of the character numbers included in brackets following the character. :)

But yeah, mafia bug with (probably) UneffectRequest, not UR bug. And hola will probably be happy if you keep trying out things for him and let him finally nip this bug, so we stop advising people to turn off his preferences. ;)
 

icefall5

Member
I know enough coding to know what you just said, and that's an interesting problem. I posted my bug report and I reposted your post here. Thank you!
 

roippi

Developer
Indices start before characters (such that substring[0] is the start of the string) but.. the point stands. That's weird.
 

Theraze

Active member
Yeah, the first letter is the 0. The 'c' of cast should be the 0 character, the 5th character (number 4) should be the space, and character 5, where it starts, SHOULD be the t of tongue... :)

All that being said... no clue why it's starting on the o.
 

O_3_141592

New member
Two Bugs - one minor and one annoying:

1) Universal Recovery does put on MP cost reducing gear even when it only casts 1MP skills (Laugh it Off).

2) When putting on MP reducing gear, Universal Recovery does not protect a juju mojo mask. It will even remove the mask from slot acc1, if other accessory slots contain gear that does not increase HP or MP (or any stats), reducing the amount of restoration possible in addition to the lost intrinsic effect.
 

HasteBro

Member
Ok, there's gotta be something wrong with the "Prefer using inventory instead of mall, regardless of value" option... I had it activated, since I have so many recovery items in my inventory, and the script was not working in several aspects. Whenever I tried restoring HP without a Scroll of Drastic Healing in inventory it gave me the message "Did not fully restore HP for some reason", it spent hundreds of thousands of meat with MP restorers (like what happened with the palm-frond fans).

So I tried deactivating it, and all of a sudden the script starts working like it should. Bale, you should check if that option is actually doing what it is supposed to do...
 
Top