Universal Recovery Script

xKiv

Active member
I am getting
Code:
Putting on stainless steel solitaire...
Equipment changed.
Putting on woven baling wire bracelets...
Equipment changed.
Casting Cannelloni Cocoon 1 times...
Cannelloni Cocoon was successfully cast.
Putting on mayfly bait necklace...
Equipment changed.
Putting on Mr. Accessory Jr....
Equipment changed.
Putting on stainless steel solitaire...
Equipment changed.
Putting on woven baling wire bracelets...
Equipment changed.
Casting Cannelloni Cocoon 1 times...
Cannelloni Cocoon was successfully cast.
Putting on mayfly bait necklace...
Equipment changed.
Putting on Mr. Accessory Jr....
Equipment changed.
Did not fully restore HP for some reason.

Of course it didn't restore to original maxhp ... there's discrepancy caused by the Mr. Jr. giving +5 to all stats!
(equip items for -MP/skill, heal to full - then equip back, which increases maxHP ...).
Any solution (because I don't like getting abort()ed)?
Other than "disable equipping -MP items"?
 

Bale

Minion
Oh dear. You're obviously using one of the interim releases I posted here, rather than the official release. That'll be fixed fairly soon when I make my next release.

For now, I'd suggest that you set your HP restoration target to 95% instead of 100%. Or else use the release I'm attaching to this post.
 
Last edited:

Bale

Minion
First thing I need to say is that due to a change in forum software there is a problem with this new release. The attachment has truncated the script's file name by 2 characters. There's nothing I can do about that, so make sure you save it as Universal_recovery.ash or else you'll have a problem.

Universal recovery v 3.53 released!


Changelog:
version 3.53 March 1, 2010
  • If auto Olfacting, it will ensure you have enough MP for the job, regardless of restoration settings
  • Moved all logic out of main so that it can be imported as a usable function in other recovery scripts
  • Lots of bugfixes
  • Several recovery logic improvements
 
Last edited:

Bale

Minion
One neat thing about this release is that I have moved all logic out of main so it can be easily imported into another script.

For example, now it is really easy to make a script that will use Dr. Lucifer's for MP recovery when more than 2000 Mp are needed and there is enough fullness. Yet it still makes full use of Universal_recovery under every other circumstance. It even makes use of Universal_recovery to decide how to restore enough HP to ensure that the Lucifer will restore full MP.

The following script will do this. Note that it is calling Univeral_recovery's restore() function for anything that it doesn't know how to handle.

PHP:
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", (my_maxmp() - 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 with 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;
}
 
Last edited:

Bale

Minion
Hell, no!

Due to a change in forum software the attachment has truncated the script's file name by 2 characters. There's nothing I can do about that, so make sure you save it as Universal_recovery.ash or else you'll have a problem.
 

adeyke

Member
The seltzer_available() seems to be confused. It checks if you have the uniform and lab key, but it then returns true if you don't.
 

Bale

Minion
Universal recovery v 3.532 released!


Changelog:
version 3.532 March 4, 2010
  • Fixed seltzer bug


Due to a change in forum software the attachment has truncated the script's file name by 2 characters. There's nothing I can do about that, so make sure you save it as Universal_recovery.ash or else you'll have a problem.
 
Last edited:

Terrabull

Member
I just encountered the seltzer bug, and came to the forum to see if something happened, apparently the auto-update is broken.
 

Muhandes

Member
Based on several occurrences in the last few days, the script uses a scroll of drastic healing before it uses the hot tub, and before it does free naps. As the tub and naps have limited use per day and what's not used is wasted, I'd think they should be used first.
I can't check this anymore, as it ate my 4 scrolls before I noticed, but if required I'd farm a few more and recheck.
 

Bale

Minion
Based on several occurrences in the last few days, the script uses a scroll of drastic healing before it uses the hot tub, and before it does free naps. As the tub and naps have limited use per day and what's not used is wasted, I'd think they should be used first.
I can't check this anymore, as it ate my 4 scrolls before I noticed, but if required I'd farm a few more and recheck.
Please post example. Please consider that it won't use a disco nap unless it can make use of both the HP & MP restoration.
 

Muhandes

Member
Please post example. Please consider that it won't use a disco nap unless it can make use of both the HP & MP restoration.

Forget disco naps, the tubs were more of an issue. Can you explain how you want the example to show any more information than what I posted? I really want to help but can't figure out how.

I have X max HP. I have Y<X currently. I have several free hot tub uses. I have a scroll. Scroll is used. That's all an example can show.

Edit: went to the session log to grab some cases:

[815] Desert (Unhydrated)
Encounter: swarm of fire ants
Round 0: muhandes loses initiative!
Round 1: muhandes attacks!
Round 2: swarm of fire ants takes 90 damage.
You lose 12 hit points
Round 2: muhandes attacks!
Round 3: swarm of fire ants takes 39 damage.
Round 3: Mmala Mala spits on your opponent. Yech.
Round 3: muhandes attacks!
Round 4: swarm of fire ants takes 43 damage.
You gain 48 Meat
You acquire an item: ant agonist
After Battle: Mmala Mala regards you with a warm smile.
You gain 12 Fortitude
You gain 16 Wizardliness
You gain 16 Sarcasm
> Restoring HP! Currently at 10 of 76 HP, 38 of 75 MP, current meat: 3012 ... Target HP = 73.

use 1 scroll of drastic healing


and much later that day:


[857] Hidden City (Square 16)
Encounter: boaraffe
Round 0: muhandes wins initiative!
Round 1: muhandes tries to steal an item!
Round 2: muhandes attacks!
Round 3: boaraffe takes 57 damage.
You lose 11 hit points
Round 3: muhandes attacks!
You lose 27 hit points
Round 4: muhandes attacks!
Round 5: boaraffe takes 56 damage.
Round 5: muhandes attacks!
Round 6: boaraffe takes 73 damage.
You gain 111 Meat
You acquire an item: long pork
After Battle: Saby Bandworm smiles a three-lipped smile from beneath the shade of his little sombrero.
You gain 17 Beefiness
You gain 11 Enchantedness
You gain a Mysticality point!
You gain 21 Sarcasm
> Restoring HP! Currently at 5 of 77 HP, 49 of 78 MP, current meat: 4518 ... Target HP = 74.

Visiting Relaxing Hot Tub in clan VIP lounge
 

Bale

Minion
It tries to save the hot tub usage for times when you have less than 1/9 of your max hp to maximize their usefulness. Your examples showed me that was happening.

There are some other considerations to make the hot tub more likely to be used when you've got few adventures left (10 per hot tub soak remaining), but that isn't important in the examples you showed me.

Incidentally, while examining your problem I noticed a really strange bug in my code hot tub code that I really have to figure out the meaning of. That wasn't your problem though.
 
Top