Universal Recovery Script

ereinion

Member
I am indeed in AoB, and very much out of ronin. Trying to visit player 2363769's store I am able to buy stuff "by hand". Furthermore, it appears I had scrolls of drastic healing in my inventory, as mafia didn't attempt to buy one when I typed "use scroll of drastic healing" into the gCLI. Unfortunately I forgot to check if the amount changed from before UR's attempts at recovering my hp and after. It would probably have been a good idea to do this while I still had turns to play :p I could check it tomorrow of course. Is there anything else I can do to help while not having adventures to spend?
 

Veracity

Developer
Staff member
Easily done. In the gCLI:

debug on
buy 1 scroll of drastic healing
debug off

and attach the debug log here.
 

ereinion

Member
Code:
[COLOR=olive]> debug on[/COLOR]

[COLOR=olive]> buy 1 scroll of drastic healing[/COLOR]

Searching for "scroll of drastic healing"...
Search complete.
Purchasing scroll of drastic healing (1 @ 453)...
Purchases complete.

[COLOR=olive]> debug off[/COLOR]
View attachment DEBUG_20131022.txt

- edit - I suppose this might be interesting as well:
Code:
> debug on

> restore hp

Restoring HP! Currently at 413 of 1547 HP, 404 of 404 MP, current meat: 20579489 ... Target HP = 1393.
Searching for "scroll of drastic healing"...
Search complete.
Purchasing scroll of drastic healing (1 @ 453)...
Purchases complete.
Using cached search results for scroll of drastic healing...
Purchasing scroll of drastic healing (1 @ 453)...
Purchases complete.
Using cached search results for scroll of drastic healing...
Purchasing scroll of drastic healing (1 @ 453)...
Purchases complete.
Did not fully restore HP for some reason.

> debug off
https://www.dropbox.com/s/teze43cgde3nzeh/DEBUG_20131022.txt (17.4 MB in size for some reason, so it might be a bit tricky to open)
 
Last edited:

Veracity

Developer
Staff member
That worked. Your debug log says this:

Processing result: scroll of drastic healing
Processing result: Meat Gained: -453
 

ereinion

Member
But isn't that correct? I did gain a scroll of drastic healing, and lose 453 meat. The item-count after UR tried to restore my hp seems to agree that I have 3 more scrolls in my inventory too. As far as I can tell, mafia is interpreting things fine, the problem is somewhere within UR which doesn't use any of the three scrolls it asked mafia to purchase?
 

Veracity

Developer
Staff member
I see no bug in KoLmafia itself, based on what you have presented. I was trying to rule that out before pointing fingers at UR. :)
 

ereinion

Member
Aha - it seems I understood your findings correctly then :) And I hope I haven't been doing too much fingerpointing, it's just that these scripts, as well as mafia itself, makes the experience of playing KoL so much better, so when one of them does something I don't expect, I really want it to function as I want again :) Which leads to me posting before exhausting all possibilities at times. I do appreciate the patience and expertize on these forums immensely, though :)
 

Theraze

Active member
Just making sure: your hpAutoRecoveryItems DOES include the scroll of drastic healing, right? It appears that if you tell mafia not to pick the scroll, it might still consider it and buy it... but never actually use it.
 

Veracity

Developer
Staff member
Let me clarify some more.

Yes - you have KoLmafia and a script working together. If things are not working correctly, perhaps KoLmafia is doing something wrong, or, perhaps the script is doing something wrong.

Theraze responded to your report by saying "KoLmafia was out of sync with your inventory. You just need to refresh your inventory."

Theraze is very fond of saying that. Sometimes he is right - and it is a KoLmafia bug, and the "correct" solution is for "KoLmafia to not get out of sync with the inventory." And sometimes he is wrong.

Now, we just had a major change to how mall purchasing works in KoL. You can buy things while in Hardcore or Ronin, and the Meat to pay for the item comes from Storage and the item goes there. I, personally, went to considerable trouble to make KoLmafia Do The Right Thing in that case. So, there was reasonable suspicion: was that happening here? Or, did I screw up detecting normal inventory Meat purchases? Or is it, in fact, a script problem?

I had you do tests and get debug logs so I could figure out if KoLmafia was, in fact, recognizing normal purchases and updating your inventory correctly. My tests worked perfectly. And when you got me a DEBUG log, it sure looks like it worked for you, too.

So, the "KoLmafia is losing track of your inventory" theory doesn't seem to be supported by the evidence of debug logs and such.

Which leaves it a UR issue, not a KoLmafia issue. But, I hate pointing fingers at Bale's code just as much as he hates pointing fingers at my code, so I asked you to investigate for me.

Now I think it's Bale's turn to investigate, however.

Not to say it's not a KoLmafia issue, still, but there is no evidence of KoLmafia wrongdoing, at the moment.
 

Theraze

Active member
When I mentioned that section, it's because that's what UR does. It won't use scrolls if you've disabled mafia using them. But it might still buy them... maybe. I'm not sure. It's not my script. :) But that's the way it looks for me.
 

Finolin

New member
Thanks again for the quick update (3.12). I'm amazed at how quickly everything gets put back into synch after content/gameplay changes.

Fin
 

ereinion

Member
When I mentioned that section, it's because that's what UR does. It won't use scrolls if you've disabled mafia using them. But it might still buy them... maybe. I'm not sure. It's not my script. :) But that's the way it looks for me.
Scrolls of drastic healing was not chosen among mafia's restore options in my settings, so it might very well be this that is the issue. Checked it now and typed "restore hp" into the gCLI, which made UR use a Camp Scout tent >_< I'll try again in a bit when my hp is a bit lower (and tents a bit more expensive, maybe). The tent wasn't chosen among the restore options either, though....

Thanks for all your help!

-edit- It seems to be using scrolls of drastic healing fine now. Still a bit odd that it bought them if it didn't intend to use them, though?
 
Last edited:

Theraze

Active member
Yeah... the part that spun me towards that was this, in the fullheal() section:
Code:
		case item_amount($item[scroll of drastic healing]) >0 && contains_text(hpAutoRecoveryItems, "drastic healing"):
			return use(1, $item[scroll of drastic healing]);
I think the fix for this would be changing this:
Code:
		case $item[scroll of drastic healing]:
			cost = cost *2/3;	// 1/3 of the time the scroll is re-used, so it is effectively cheaper.
			break;
in the best_mall() function over to
Code:
		case $item[scroll of drastic healing]:
			if (contains_text(hpAutoRecoveryItems, "drastic healing")) cost = cost *2/3;	// 1/3 of the time the scroll is re-used, so it is effectively cheaper.
			else cost = -1; // Don't use scrolls unless specified in options.
			break;
 

Bale

Minion
Veracity, Thanks for checking out the KoLmafia end of things for us.

Theraze, Sorry, but your "fix" will introduce undesired behavior. Specifically, in mallmode the script should still be willing to purchase and use scrolls of drastic healing, even if they are disabled for ronin/hardcore use. This script has two different modes of behavior and they need to play nice together. Here's my fix.


Universal recovery v 3.12.1 released!


Changelog:
version 3.12.1 October 24, 2013
  • Adventurer of Leisure doubles the healing power of a Disco Nap
  • Fix bug caused by using restricted items in mallmode


Download Universal Recovery v3.12.1 here: View attachment 8026
(Universal_Recovery.ash goes in the /scripts folder)​
 
Last edited:

fronobulax

Developer
Staff member
Could you please switch to svn distribution
...
I don't push all scripters to switch to SVN. You're the only one I'm bugging because this is the only script I really like which isn't there yet.

Oh wait. That is Bale talking about some other script, not me talking to Bale about UR :)


(I understand your reasons but since 1UP seems to be taking longer than expected, maybe it is time to SVN UR? Pretty please?)
 

Bale

Minion
Nope! Won't do it! When I make this script old news I don't want to have had people downloading it on SVN thinking it is still up to date.
 

Fluxxdog

Active member
Since we're on the subject, how is 1UP coming along? Not asking for an ETA, just curious as to major obstacles.
 

Bale

Minion
I ran into a problem with uneffecting harmful effects and finally decided to work-around by simply copying in the old code from UR so that I could focus on the core elements of the script. I'm not real happy with that decision, but I was getting really bogged down. It was eating up a lot of effort for something that was fairly minor.
 
Top