Universal Recovery Script

Something weird is happening every time I ascend.

If I forget to turn off healing mafia is making me rest on my clan sofa between 5-8 times to restore all my MP (I usually cast mojo as soon as i ascend).

Is there any way to stop it doing this? It is untagged on my healing list.
 
Ok, here you go - I ascended, pulled my stuff from hagnks, put it on and cast mojo, then clicked on the knob for my first adventure:


equip shirt sugar shirt

[1] Outskirts of The Knob
Encounter: sleeping Knob Goblin Guard
Round 0: REDACTED wins initiative!
Round 1: REDACTED uses the turtle totem!
You gain 14 Muscularity Points
You lose 13 hit points
Round 2: REDACTED uses the turtle totem!
You gain 14 Muscularity Points
Round 3: REDACTED uses the turtle totem!
You gain 15 Muscularity Points
You lose 13 hit points
Round 4: REDACTED casts RETURN!
> Restoring HP! Currently at 9 of 79 HP, 43 of 70 MP, current meat: 0 ... Target HP = 79.

cast 1 Tongue of the Walrus
You gain 34 hit points

cast 1 Lasagna Bandages
You gain 15 hit points

[1] Rest in Clan Sofa (8 turns)
You gain 38 Muscularity Points

I'm not sure if it is Mafia or the script, i've not seen mafia do it before I installed it, and the box next to Rest on Sofa is unticked.
 
i've not seen mafia do it before I installed it, and the box next to Rest on Sofa is unticked.

Are you sure it is unticked on both the Hp and Mp sides of the dialogue? Try entering the following two lines in the CLI and copy-paste the results.

Code:
get mpAutoRecoveryItems

get hpAutoRecoveryItems
 
Sorry if I'm like a moron here, but what am I doing wrong? I've never scripted anything before, but I wanted to script some of this slime tube because it's really a grind. I've tried searching both this thread and the slime tube script one, but cannot seem to figure out what I've missed here.

I installed slime.ash and universal_recovery.ash (and the relay parts for both). From the CLI, I "call slime 1" which adventures in the slime tube for one turn and uses a chamoix if needed. After it's finished, I don't see any hint of auto recovery, and I have to cast cannelloni cocoon manually.

I have definitely set the recovery script to Universal_recovery. I've tried playing with the settings under HP/MP usage but I can't seem to get my HP to recover. I've tried setting "Auto-recover health" at both 5% and 95% to see where it might trigger itself to recovery my health. I only have checked scroll of drastic healing and cannelloni cocoon.

I thought maybe it didn't work until you needed health at the beginning of a turn, so I manually healed and tried to slime for 2 adventures. It just let me die instead.

I think I've done something very wrong here.

Code:
> set recoveryScript = Universal_recovery

> call slime 1

The slimes in the tube or that slime covering you will kill you if you don't do something! Hitting up your clan.
You lose an effect: Coated in Slime
Chamois successfully used.
I'm feeling rather... dry. Let's go get slimy!
Putting on minml...
You are already wearing "minml."
Adventure 1 out of 1

[1719] The Slime Tube
Encounter: puckering Slime mouth
Round 0: KingArt loses initiative!
You acquire an effect: Coated in Slime (duration: 5 Adventures)
You lose 1,908 hit points
Round 1: KingArt executes a macro!
Round 1: KingArt attacks!
You acquire an item: slimy fermented bile bladder
You gain 87 Muscleboundness
You gain 39 Magicalness
You gain 43 Smarm

> cast can

Casting Cannelloni Cocoon 1 times...
You gain 1,890 hit points
Cannelloni Cocoon was successfully cast.

> call slime 2

The slimes in the tube or that slime covering you will kill you if you don't do something! Hitting up your clan.
You lose an effect: Coated in Slime
Chamois successfully used.
I'm feeling rather... dry. Let's go get slimy!
Putting on minml...
You are already wearing "minml."
Adventure 1 out of 2

[1720] The Slime Tube
Encounter: puckering Slime maw
Round 0: KingArt loses initiative!
You acquire an effect: Coated in Slime (duration: 5 Adventures)
You lose 1,908 hit points
You lose 12 hit points
Round 1: KingArt executes a macro!
Round 1: KingArt attacks!
You gain 83 Strengthliness
You gain 36 Enchantedness
You gain 49 Chutzpah
The slimes in the tube or that slime covering you will kill you if you don't do something! Hitting up your clan.
You lose an effect: Coated in Slime
Chamois successfully used.
I'm feeling rather... dry. Let's go get slimy!
Putting on minml...
You are already wearing "minml."
Adventure 2 out of 2

[1721] The Slime Tube
Encounter: chomping Slime mouth
Round 0: KingArt loses initiative!
You acquire an effect: Coated in Slime (duration: 5 Adventures)
You lose 1,908 hit points
You gain 14 hit points
 
Any idea when the next release will come out?

Some script I am running tries to rest at the campground when there are zero adventures left and as a result, mafia keeps looping. I believe that all my scripts will abort if they want to rest and there are zero adventures left. Is there any possibility that the culprit could be UR? (Not saying it is, but having looked at everything I understand easily, asking a question is easier than digging deeper).

I have not run the numbers but it seems to me that there are a set of conditions where using a Jumbo Dr. Lucifer in combination with Cannelloni Cocoon is the most effective way to restore all MP. (Obviously restoring HP is trivial). Is UR likely to do this for me automagically if I have my restore thresholds set appropriately or should I just do this myself?

Thank you.
 
I've tried searching both this thread and the slime tube script one, but cannot seem to figure out what I've missed here.
I think you missed how slime.ash works: your minml outfit isn't a minml outfit at all, since when the script re-slimes using it, you get 5 turns of Coated in Slime (instead of the usual 10 or 8 depending on what kind of +ML effects you have running).

In any case, the lack of healing isn't your fault. In your example, the problem is with slime.ash not asking for HP to be restored before adventuring in the slimetube for re-sliming. Check the last few of pages of the slime.ash thread for a couple of fixes (check this post, as well as this one ).

And change this minml outfit =)
 
I think you missed how slime.ash works: your minml outfit isn't a minml outfit at all, since when the script re-slimes using it, you get 5 turns of Coated in Slime (instead of the usual 10 or 8 depending on what kind of +ML effects you have running).

In any case, the lack of healing isn't your fault. In your example, the problem is with slime.ash not asking for HP to be restored before adventuring in the slimetube for re-sliming. Check the last few of pages of the slime.ash thread for a couple of fixes (check this post, as well as this one ).

And change this minml outfit =)

Oh! I didn't understand that at all, because the initial description of the slime script says that it doesn't handle restoration, thus it recommended this universal recovery script. I still don't get the minml outfit, but it appears to work the way I expect by changing that one line of code you pointed out. Thank you so much!

Update: I'm noticing a bit later that it's now wasting dozens of my casts, phonics downs, sugar shards etc to refill my HP when I only have cocoon selected. Is this normal? Like, if I have drained my MP down to 300/900, it will waste items to refill my MP even though I've told Mafia not to do this. If I leave my MP basically maxed (wasted), it will only use cocoon. If I turn off the Universal_recovery as my default recovery thing, it seems to work. Do I need the universal recovery?
 
Last edited:
Update: I'm noticing a bit later that it's now wasting dozens of my casts, phonics downs, sugar shards etc to refill my HP when I only have cocoon selected. Is this normal? Like, if I have drained my MP down to 300/900, it will waste items to refill my MP even though I've told Mafia not to do this. If I leave my MP basically maxed (wasted), it will only use cocoon. If I turn off the Universal_recovery as my default recovery thing, it seems to work. Do I need the universal recovery?

That sounds really messed up. UR seems to be in hardcore mode where it will use any items you have available. Have you turned off mafia's preference to purchase from the mall? What restoration levels have you set? Finally, please set verbosity to maximum and copy-paste CLI output that shows what you're talking about.

Some script I am running tries to rest at the campground when there are zero adventures left and as a result, mafia keeps looping. I believe that all my scripts will abort if they want to rest and there are zero adventures left. Is there any possibility that the culprit could be UR? (Not saying it is, but having looked at everything I understand easily, asking a question is easier than digging deeper).
Oh. That's a bug. Fixing it. You'll find the new version in the usual place.

I have not run the numbers but it seems to me that there are a set of conditions where using a Jumbo Dr. Lucifer in combination with Cannelloni Cocoon is the most effective way to restore all MP. (Obviously restoring HP is trivial). Is UR likely to do this for me automagically if I have my restore thresholds set appropriately or should I just do this myself?

While that is definitely true, UR will never use up fullness/inebriety/spleen. You'll have to do that for yourself or use a modified UR like this:

Code:
import <Universal_recovery.ash>

boolean lucifer_restore(string type, int amount) {
	if(type == "MP" && my_fullness() < fullness_limit()) {
		if(amount == 0)
			amount = mp_autotarget;
		amount = min(my_maxmp(), amount);
		if(amount - my_mp() > 2000 && restore("HP", (amount - my_mp()) / 9)) {
			retrieve_item(1, $item[Jumbo Dr. Lucifer]);
			eatsilent(1, $item[Jumbo Dr. Lucifer]);
			if(my_mp() >= amount)
				return true;
			else {
				print("Failed to restore by consuming a Jumbo Dr. Lucifer. Somehow.", "red");
				return false;
			}
		}
	}
	return restore(type, amount);
}

boolean main(string type, int amount) {
	if(!lucifer_restore(type, amount))
		abort("Did not fully restore "+ type + " for some reason.");
	return true;	// This ensures that mafia does not attempt to heal with resources that are being conserved.
}
 
I don't have Mafia set as being allowed to shop from the mall as far as I can tell. (It also doesn't appear to be shopping.) It's just using items in my inventory to refill my MP when I prefer to just let my equipment refill my MP.

As you can see, it works as expected when my MP is full, but if I use it manually say, to summon brickos, it feels the urge to refill it.

What's this verbose thing you're talking about? Is this the debug option that says to communicate between the browser and mafia?


Code:
clan_slimetube.php?action=chamois
> Chamois successfully used.
 > I'm feeling rather... dry. Let's go get slimy!
custom outfit minml
 > Restoring HP! Currently at 527 of 2094 HP, 246 of 876 MP, current meat: 108622 ... Target HP = 2094.

use 12 ancient Magi-Wipes
You gain 660 hit points
You gain 668 Muscularity Points

use 4 Doc Galaktik's Homeopathic Elixir
You gain 74 hit points

use 42 cast
You gain 739 hit points

use 3 Doc Galaktik's Restorative Balm
You gain 41 hit points

use 1 pixellated candy heart
You gain 5 hit points

use 3 cast
You gain 55 hit points
 > Adventure 1 out of 1

[1895] The Slime Tube
Encounter: gnashing Slime mouth
Round 0: KingArt loses initiative!
You lose 1,718 hit points
You lose 14 hit points
Round 1: KingArt executes a macro!
Round 1: KingArt attacks!
You gain 77 Fortitude
You gain 37 Enchantedness
You gain 26 Cheek
 > The slimes in the tube or that slime covering you will kill you if you don't do something! Hitting up your clan.

clan_slimetube.php?action=chamois
> Chamois successfully used.
 > I'm feeling rather... dry. Let's go get slimy!
custom outfit minml
 > Restoring HP! Currently at 389 of 2132 HP, 832 of 832 MP, current meat: 108622 ... Target HP = 2132.

cast 1 Cannelloni Cocoon
You gain 1,743 hit points
 > Adventure 1 out of 1

[1896] The Slime Tube
Encounter: puckering Slime maw
Round 0: KingArt loses initiative!
You lose 1,718 hit points
Round 1: KingArt executes a macro!
Round 1: KingArt attacks!
You acquire an item: slimy fermented bile bladder
You gain 62 Strongness
You gain 40 Enchantedness
You gain 38 Roguishness
 > The slimes in the tube or that slime covering you will kill you if you don't do something! Hitting up your clan.

clan_slimetube.php?action=chamois
> Chamois successfully used.
 > I'm feeling rather... dry. Let's go get slimy!
custom outfit minml
 > Restoring HP! Currently at 432 of 2132 HP, 822 of 832 MP, current meat: 108622 ... Target HP = 2132.

cast 1 Cannelloni Cocoon
You gain 1,700 hit points
 > Adventure 1 out of 2

[1897] The Slime Tube
Encounter: gaping Slime maw
Round 0: KingArt loses initiative!
You lose 1,718 hit points
You lose 15 hit points
Round 1: KingArt executes a macro!
Round 1: KingArt attacks!
You gain 70 Beefiness
You gain 36 Mysteriousness
You gain 34 Sarcasm
 > The slimes in the tube or that slime covering you will kill you if you don't do something! Hitting up your clan.

clan_slimetube.php?action=chamois
> Chamois successfully used.
 > I'm feeling rather... dry. Let's go get slimy!
custom outfit minml
 > Restoring HP! Currently at 409 of 2094 HP, 828 of 876 MP, current meat: 108622 ... Target HP = 2094.

cast 1 Cannelloni Cocoon
You gain 1,685 hit points
 > Adventure 2 out of 2

[1898] The Slime Tube
Encounter: puckering Slime beak
Round 0: KingArt loses initiative!
You lose 1,687 hit points
Round 1: KingArt executes a macro!
Round 1: KingArt attacks!
You gain 76 Muscleboundness
You gain 33 Magicalness
You gain 31 Cheek
You gain a Moxie point!

cast 3 Summon BRICKOs
You acquire BRICKO brick (3)
You acquire BRICKO brick (3)
You acquire BRICKO brick (3)
 > The slimes in the tube or that slime covering you will kill you if you don't do something! Hitting up your clan.

clan_slimetube.php?action=chamois
> Chamois successfully used.
 > I'm feeling rather... dry. Let's go get slimy!
custom outfit minml
 > Restoring HP! Currently at 427 of 2094 HP, 66 of 876 MP, current meat: 108622 ... Target HP = 2094.

use 17 phonics down
You gain 817 hit points
You gain 818 Muscularity Points

use 40 cast
You gain 705 hit points

cast 1 Cannelloni Cocoon
You gain 155 hit points
 > Adventure 1 out of 1

[1899] The Slime Tube
Encounter: gnashing Slime maw
Round 0: KingArt loses initiative!
You lose 1,695 hit points
Round 1: KingArt executes a macro!
Round 1: KingArt attacks!
You acquire an item: slimy sweetbreads
You acquire an item: slimy fermented bile bladder
You gain 73 Fortitude
You gain 27 Wizardliness
You gain 39 Smarm

cast 1 Summon BRICKOs
You acquire BRICKO brick (3)
 > The slimes in the tube or that slime covering you will kill you if you don't do something! Hitting up your clan.

clan_slimetube.php?action=chamois
> Chamois successfully used.
 > I'm feeling rather... dry. Let's go get slimy!
custom outfit minml
 > Restoring HP! Currently at 438 of 2104 HP, 583 of 884 MP, current meat: 108622 ... Target HP = 2104.

use 6 phonics down
You gain 288 hit points
You gain 290 Muscularity Points

use 1 sugar shard
You gain 17 hit points
You gain 9 Muscularity Points

cast 1 Cannelloni Cocoon
You gain 1,361 hit points
 > Adventure 1 out of 1

[1900] The Slime Tube
Encounter: gaping Slime mouth
Round 0: KingArt loses initiative!
You lose 1,695 hit points
Round 1: KingArt executes a macro!
Round 1: KingArt attacks!
You gain 74 Strengthliness
You gain 30 Wizardliness
You gain 34 Chutzpah
 > The slimes in the tube or that slime covering you will kill you if you don't do something! Hitting up your clan.

clan_slimetube.php?action=chamois
> Chamois successfully used.
 > I'm feeling rather... dry. Let's go get slimy!
custom outfit minml
 > Restoring HP! Currently at 430 of 2104 HP, 884 of 884 MP, current meat: 108622 ... Target HP = 2104.

cast 1 Cannelloni Cocoon
You gain 1,674 hit points
 > Adventure 1 out of 2

[1901] The Slime Tube
Encounter: puckering Slime mouth
Round 0: KingArt loses initiative!
You lose 1,695 hit points
You lose 15 hit points
Round 1: KingArt executes a macro!
Round 1: KingArt attacks!
You gain 59 Muscleboundness
You gain a Muscle point!
You gain 41 Mysteriousness
You gain 39 Roguishness
 > The slimes in the tube or that slime covering you will kill you if you don't do something! Hitting up your clan.

clan_slimetube.php?action=chamois
> Chamois successfully used.
 > I'm feeling rather... dry. Let's go get slimy!
custom outfit minml
 > Restoring HP! Currently at 408 of 2109 HP, 884 of 884 MP, current meat: 108622 ... Target HP = 2109.

cast 1 Cannelloni Cocoon
You gain 1,701 hit points
 > Adventure 2 out of 2

[1902] The Slime Tube
Encounter: puckering Slime maw
Round 0: KingArt loses initiative!
You lose 1,699 hit points
You lose 14 hit points
Round 1: KingArt executes a macro!
Round 1: KingArt attacks!
You gain 77 Strongness
You gain 38 Enchantedness
You gain 25 Roguishness
 > The slimes in the tube or that slime covering you will kill you if you don't do something! Hitting up your clan.

clan_slimetube.php?action=chamois
> Chamois successfully used.
 > I'm feeling rather... dry. Let's go get slimy!
custom outfit minml
 > Restoring HP! Currently at 425 of 2109 HP, 884 of 884 MP, current meat: 108622 ... Target HP = 2109.

cast 1 Cannelloni Cocoon
You gain 1,684 hit points
 > Adventure 1 out of 6

[1903] The Slime Tube
Encounter: gnashing Slime beak
Round 0: KingArt loses initiative!
You lose 1,699 hit points
Round 1: KingArt executes a macro!
Round 1: KingArt attacks!
You gain 73 Strongness
You gain 36 Enchantedness
You gain 30 Roguishness
 > The slimes in the tube or that slime covering you will kill you if you don't do something! Hitting up your clan.

clan_slimetube.php?action=chamois
> Chamois successfully used.
 > I'm feeling rather... dry. Let's go get slimy!
custom outfit minml
 > Restoring HP! Currently at 427 of 2109 HP, 879 of 884 MP, current meat: 108622 ... Target HP = 2109.

cast 1 Cannelloni Cocoon
You gain 1,682 hit points
 > Adventure 2 out of 6

[1904] The Slime Tube
Encounter: puckering Slime maw
Round 0: KingArt loses initiative!
You lose 1,699 hit points
You lose 14 hit points
Round 1: KingArt executes a macro!
Round 1: KingArt attacks!
You gain 71 Strengthliness
You gain 31 Mysteriousness
You gain 37 Sarcasm
 
UR recovers your MP while restoring your HP, since with your current MP restore setting, MP restoration will be called afterwards anyway.

You should set your MP restoration threshold lower, and I suggest you use Mafia's MP burning feature to take care of BRICKO summoning.

EDIT: in the context of UR, Verbosity is a setting you can access either through the Relay Browser version of UR, either through the baleUr_Verbosity Mafia preference (by typing set baleUr_Verbosity = 3 in the gCLI).
 
UR recovers your MP while restoring your HP, since with your current MP restore setting, MP restoration will be called afterwards anyway.

You should set your MP restoration threshold lower, and I suggest you use Mafia's MP burning feature to take care of BRICKO summoning.

That's all well and good except that I've told Mafia to NEVER restore my MP. I just don't want it to. I've told Mafia also never to use any items to restore my HP either. Only cast cocoon. This is the first time I've tried to automate anything at all in mafia, and I'm beginning to learn that losing control is not for me.

I'm definitely starting to believe that it's not UR at all causing issues though. I turned UR off, and went back to letting Mafia handle my restores. I used the slime.ash, and it still restores HP, even though the original creator says it does not. I think I can live with the scenario as it is. I've learned to work within the system I've got now, and things appear to be working. (I'm only scripting the tube, nothing else.)

Thanks to both of you for all your help!
 
What were your exact Restore your Mana settings? I guess you had "Auto-recover your mana at 30%" (or more). If you really told Mafia to never restore MP, then perhaps there's a bug somewhere. Could you use the same settings as when you where having the problem, and type this in the gCLI:
Code:
ashq print(get_property("mpAutoRecovery"));
What does it return?
Or could you type set baleUr_Verbosity = 3 in the gCLI and try to reproduce the problem?

Also, UR doesn't follow the same settings as Mafia's build-in recovery. If you check the first post, you will see that UR will follow some of the choices that are checked in the Use these restores: lists, but all the others are always authorized. So telling Mafia not to use any items won't matter to UR.

UR is meant to optimize HP/MP restoration. Be it in-run or in aftercore. If you are in aftercore, and deliberately prevent it from using the mall, you are stopping UR from getting the cheapest restorers. In your case, that would be Cocoon for HP, but for MP it would be better to let UR have mall access (you can leave Mafia's mall access off and turn it on only for UR, in the relay configuration script).

One last thing: where does Alhifar say that his script doesn't restore HP? The script itself doesn't do it, but it does ask Mafia to restore it. Mafia then calls UR if you set it as your recovery script.

Apparently, you concluded that you didn't need something as complicated as UR to optimize restoration. With Cocoon for HP, and MP regen, it's only a matter of casting Cocoon when needed, and that's something Mafia's build-in restoration does very well.
 
Having an odd issue that only occured in the last 50 turns and only noticed as it burned through my cash, while farming belowdecks for a talisman.
Not sure why it choose to use Doc Galaktik's rather than medicinal herbs.

> get hpAutoRecoveryItems

free disco rest;galaktik's curative nostrum;medicinal herb's medicinal herbs;scroll of drastic healing;cannelloni cocoon;visit the nuns;disco power nap;tongue of the walrus;tiny house;disco nap;lasagna bandages;doc galaktik's homeopathic elixir;cast;doc galaktik's restorative balm;doc galaktik's ailment ointment;doc galaktik's pungent unguent

Restoring HP! Currently at 108 of 241 HP, 52 of 93 MP, current meat: 7855 ... Target HP = 193.
Visiting Doc Galaktik...

Restore 84 HP at Doc Galaktik's
You gain 84 hit points
You spent 504 Meat
Cure purchased.
 
When you are not in mallcore, UR only uses fullheal items when they are the most useful. In the code, this is expressed line 1050 by:
Code:
my_hp() < ceil(my_maxhp() / 6.0)

In your example, that would be 40 hp.

You can either change your healing settings to "Auto-recover health at 15%" (if you can survive going in combat with 20% of your HP), edit line 1050 of the code, or stop using UR when you want Mafia to always use herbs.
 
Last edited:
I thought the idea was that during ronin, it used the most optimal way to heal by saving money ? and 100meat for the herbs would be far more cost efficient?
 
100 meat for 200 HP is more cost efficient than 100 meat for 133 HP, as in your example. In the case of limited-use items like Herbs or Scrolls of drastic healing that you happen to have in your inventory, Bale decided they would only be used when you had less than 15% of your max HP. The limit could be discussed, but at least it ensures that you won't use 1 spleen to heal 10 HP.
 
Since I have a fully-decorated Gingerbread house, my first disco nap essentially functions as a +20% Item/Meat buff rather than just HP/MP restoration. Is there a way to take this into consideration?
 
Back
Top