Universal Recovery Script

fronobulax

Developer
Staff member
n kingdom of explothing doc galactic is unavailable. So if you run out of other restorers and it tries to resort to buying from galactic it gives the following infinite loop

Noted. Galaktik availability is assumed in a lot of places and I have not found a quick fix. But I am looking. Thank you.
 

taltamir

Member
Noted. Galaktik availability is assumed in a lot of places and I have not found a quick fix. But I am looking. Thank you.
How about using this function
https://wiki.kolmafia.us/index.php?title=My_path

Make a bool called galaktik_avail which is used in various galaktik bought restorers to check if galactic is available.
on running the script it can check if my path is exploathing, and if it is then set galaktik_avail to false. otherwise set it to true. (it will pretty much need to be checked every time it is run, because breaking prism makes it available again)

If other paths are added in the future that block galactic, they can be added to that check
 

fronobulax

Developer
Staff member
How about using this function
https://wiki.kolmafia.us/index.php?title=My_path

Make a bool called galaktik_avail which is used in various galaktik bought restorers to check if galactic is available.
on running the script it can check if my path is exploathing, and if it is then set galaktik_avail to false. otherwise set it to true. (it will pretty much need to be checked every time it is run, because breaking prism makes it available again)

If other paths are added in the future that block galactic, they can be added to that check

That was the quick fix I was hoping for :) but I don't see how to do it quickly.

There are 5-10 places where Galaktik is hard coded. There are several places where the script assumes success because it assumes Galaktik is available. However the script can fail if (for example) there is no meat to purchase Galaktik so I'm thinking I need to trigger the failure if Galaktik is unavailable as well. I am also trying to resist the Coder's Curse and decide it is easier to rewrite something than to understand it.
 

fronobulax

Developer
Staff member
What is baleUr_AlwaysContinue for you?

If it is true, setting it to false might get around the infinite loop.
 

Terrabull

Member
Just had a critical error with UR. I was in the middle of running FantasyRealm.ash
Session and error logs included.
 

Attachments

  • DEBUG_20200108.txt
    10.6 KB · Views: 15
  • terrabull_20200108.txt
    62 KB · Views: 16

fronobulax

Developer
Staff member
Just had a critical error with UR. I was in the middle of running FantasyRealm.ash
Session and error logs included.

I'm not getting anything from the logs I can use. Maybe someone smarter than me will look at them?

It looks like some recovery is happening in FantasyRealm so I am not sure what the trigger might have been. The debug log suggests checking the Dispensary so if that is unavailable perhaps something is assuming that rather than checking? I sometimes see null pointers when manipulating lists so there also might be KoLmafia bug that has not been dealt with - i.e. a list that needs to be synchronized.

I would verify that the Dispensary is available or that lastDispensaryOpen is set properly. I would look at the list of restores UR is allowed to use and see if there is something that is not actually available. But I'm just throwing ideas out.
 

Terrabull

Member
Somehow Medicinal Herb's got turned on (I know I turned if off) and I'm a myst class, so that was probably it. Haven't had any problems since.

Thank you.
 
Last edited:

Terrabull

Member
Sorry to double post but I just got this message:

There was a problem accessing the Map Manager.
Restorative data is corrupted or missing. Troublesome!

It goes away if I unset Universal Recovery. Was working fine yesterday. Just updated to the new daily build (which was 7 days ago.) but it's still there.
 

Attachments

  • terrabull_20200124.txt
    36.2 KB · Views: 31

zarqon

Well-known member
Seems like my domain has an expired certificate again. Gah.

I'd recommend changing line 144 from

Code:
		if(!load_current_map(fname,heal) || count(heal) == 0)

to

Code:
		if(!load_current_map(fname,heal) && count(heal) == 0)

In that case even if the domain can't be accessed, UR will still continue so long as your restorative map loaded locally.
 

fronobulax

Developer
Staff member
That fix is behaving for me so I will commit it in a few moments. It does spam the GCI with "There was a problem accessing the Map Manager." but that is a small price to pay.

I will note that the version of the file at the Map Manager is dated 08/30/2019. The version on my disk is dated 02/07/2017 which suggests something strange to me, but I won't investigate further until the cert is updated.

Also UR does not know about the Milk change. It did not look like a simple fix to me and since no one has complained nor offered a patch I have been letting it slide.
 

zarqon

Well-known member
Hopefully my host can get it sorted soon.

Does UR do anything with milk? Searching UR for "milk" has no results.
 

fronobulax

Developer
Staff member
Hopefully my host can get it sorted soon.

Does UR do anything with milk? Searching UR for "milk" has no results.

Duh. You are correct. It is EatDrink. I had conflated the "not mine but I am trying to maintain anyway" scripts in my mind. I blame my failure to finish my morning coffee before I posted.
 

Terrabull

Member
So this is a thing that just happened:

Code:
In mallmode, best MP restorative is: palm frond @     1875.0 meat total.
In mallmode, best HP     restorative is: Medicinal Herb's medicinal herbs @ 100.0 meat total.
In     mallmode, best MP restorative is: palm frond @ 1875.0 meat total.
In     mallmode, best HP restorative is: Medicinal Herb's medicinal herbs @ 100.0     meat total.

[1124] Gingerbread Upscale Retail District
Encounter:     gingerbread tech bro
Round 0: terrabull wins initiative!
Round 1:     terrabull executes a macro!
Round 1: terrabull attacks!
Round 2: You     lose 34 hit points
Round 2: terrabull attacks!
Round 3: You lose 33     hit points
Round 3: terrabull attacks!
Round 4: You lose 34 hit     points
Round 4: terrabull attacks!
Round 5: You lose 34 hit points
Round     5: terrabull attacks!
Round 6: You lose 33 hit points
You lose an     effect: Beaten Up (1)
In mallmode, best MP     restorative is: palm frond @ 1875.0 meat total.
In     mallmode, best HP restorative is: Medicinal Herb's medicinal herbs @ 100.0     meat total.
Restoring HP! Currently at 9     of 343 HP, 207 of 240 MP, current meat: 11585848 ... Target HP = 155.
In     mallmode, best HP restorative is: Medicinal Herb's medicinal herbs @ 100.0     meat total.
In mallmode, best MP restorative     is: palm frond @ 375.0 meat total.
Mall price     to restore 17MP is 107 meat.
Trying to use 1     Medicinal Herb's medicinal herbs
Purchasing Medicinal Herb's     medicinal herbs (1 @ 95)...
You spent 95 Meat
You acquire an item:     Medicinal Herb's medicinal herbs
Purchases complete.
Current     HP: 9, MP: 207
In mallmode, best HP     restorative is: Medicinal Herb's medicinal herbs @ 100.0 meat total.
In     mallmode, best MP restorative is: palm frond @ 375.0 meat total.
Mall     price to restore 17MP is 107 meat.
Trying to     use 1 Medicinal Herb's medicinal herbs
Purchasing Medicinal     Herb's medicinal herbs (1 @ 95)...
You spent 95 Meat
You acquire an     item: Medicinal Herb's medicinal herbs
Purchases complete.
Current     HP: 9, MP: 207
In mallmode, best HP     restorative is: Medicinal Herb's medicinal herbs @ 100.0 meat total.
In     mallmode, best MP restorative is: palm frond @ 375.0 meat total.
Mall     price to restore 17MP is 107 meat.
Trying to     use 1 Medicinal Herb's medicinal herbs
Purchasing Medicinal     Herb's medicinal herbs (1 @ 95)...
You spent 95 Meat
You acquire an     item: Medicinal Herb's medicinal herbs
Purchases complete.
Current     HP: 9, MP: 207
My meat: 11585563. Sadly I     think healing failed...
Did not fully restore     HP for some reason.

I have 0 spleen full, it's checked in the options, and I also have Cannonoli Caccoon, so for 20MP I could have rested just fine. Why did it buy the herbs, but not use them?

It keeps buying more and more herbs (I think I have 11 on hand now, and refuses to use them for some reason.
 
Last edited:

taltamir

Member
universal recovery infinite loops in plumber, trying to heal using a Doc Galaktik's Homeopathic Elixir


Note that it does not actually buy it. It can be bought in [Path of the Plumber] but cannot be used. which is why mafia automatically blocks scripts from buying it, you can only buy it manually but have no reason to ever do so.


=============

Code:
Restoring HP! Currently at 110 of 464 HP, 284 of 284 MP, current meat: 22944 ... Target HP = 441.
Recovery target reduced to healing trigger (139)to conserve meat.
Purchasing Doc Galaktik's Homeopathic Elixir (1 @ 120)...
You spent 120 Meat
You acquire an item: Doc Galaktik's Homeopathic Elixir
Purchases complete.
Using 1 Doc Galaktik's Homeopathic Elixir...
You gain no hit points
Finished using 1 Doc Galaktik's Homeopathic Elixir.
Purchasing Doc Galaktik's Homeopathic Elixir (1 @ 120)...
You spent 120 Meat
You acquire an item: Doc Galaktik's Homeopathic Elixir
Purchases complete.
Using 1 Doc Galaktik's Homeopathic Elixir...
You gain no hit points
Finished using 1 Doc Galaktik's Homeopathic Elixir.
Purchasing Doc Galaktik's Homeopathic Elixir (1 @ 120)...
You spent 120 Meat
You acquire an item: Doc Galaktik's Homeopathic Elixir
Purchases complete.
Using 1 Doc Galaktik's Homeopathic Elixir...
You gain no hit points
Finished using 1 Doc Galaktik's Homeopathic Elixir.
Purchasing Doc Galaktik's Homeopathic Elixir (1 @ 120)...
You spent 120 Meat
You acquire an item: Doc Galaktik's Homeopathic Elixir
Purchases complete.
Using 1 Doc Galaktik's Homeopathic Elixir...
You gain no hit points
Finished using 1 Doc Galaktik's Homeopathic Elixir.
Purchasing Doc Galaktik's Homeopathic Elixir (1 @ 120)...
You spent 120 Meat
You acquire an item: Doc Galaktik's Homeopathic Elixir
Purchases complete.
 

fronobulax

Developer
Staff member
universal recovery infinite loops in plumber, trying to heal using a Doc Galaktik's Homeopathic Elixir

I solved this by not using UR as a Plumber once native mafia recovery knew what to do.

NPC availability is pretty strongly assumed in UR so I'm not expecting a simple fix.
 

taltamir

Member
I solved this by not using UR as a Plumber once native mafia recovery knew what to do.

NPC availability is pretty strongly assumed in UR so I'm not expecting a simple fix.
Wouldn't a simple fix be to do the following early in the script
Code:
(my_path() == "Path of the Plumber")
    mushrooms();
where mushrooms() is a function that just eats healing mushrooms as needed and that's it? (and blocks the running of all other functionality)

plumber is not an overly complicated healing system. MP is hidden and only used for 1 thing and shouldn't be recovered.
HP is recovered via:
saveblock = 1 adv for full heal
3 different mushroom types bought from the same store for different prices that heal 10, 30, or 100 HP respectively.
 
Top