Universal Recovery Script

I noticed that UR was buying carbonated water lilies in the mall, despite the fact that there were thousands of that item in the clan stash (and my character is karma-exempt).

Mafia prefs are to freely use items in the stash as needed, as well as freely purchase items in the mall as needed, and UR prefs are to freely purchase items as needed, but not to prefer the inventory over the mall (does that setting affect the use of the clan stash over the mall, BTW?).
 
Sorry, but this script isn't going to access the clan stash at all. Since mafia won't tell me if your character is karma-exempt, or if you've switched clans, I'm not even going to try. It would be unnecessarily difficult and awkward to implement.
 
You will have to stock up your inventory with carbonated water lilies yourself before adventuring then. UR will use them when they are optimal.
 
Sorry, but this script isn't going to access the clan stash at all. Since mafia won't tell me if your character is karma-exempt, or if you've switched clans, I'm not even going to try. It would be unnecessarily difficult and awkward to implement.

What mafia function are you using to obtain items? If you are using a "higher level" one, such as acquire, it seems to me that there might be a case for a feature request if the function doesn't automagically deal with the stash. If, however, you are replicating acquire's decision making in the script then Nevermind.
 
I'm using the three parameter version of buy. There's some pretty good reasons for it.

It wouldn't be hard to add a check into purchase(), for stash_amount() and take_stash() if they're there, but the possibility of clan hopping (a not unlikely event) makes mockery of the idea until such a time as mafia tracks current clan. Also, I'd need to know if your clan karma was exempt. If both of those features were added, then I'd be all for adding it to UR.

I'm not even sure that acquire() works well with this situation due to clan hopping which is something I do as well as other people I know.
 
Last edited:
I know acquire will pull items from the clan stash if they are there. What I don't know is how that interacts with karma and clan hopping. I presume the problem with clan hopping is the server hits required to verify/validate the stash contents. I see karma as a limited resource like Hagnk's pulls that should only be used by mafia under controlled and well defined circumstances.

For the record I'm anti-social enough that my three characters have been in a total of four clans over their lifetime so clan hopping is an extremely rare event ;-)
 
For the record I'm anti-social enough that my three characters have been in a total of four clans over their lifetime so clan hopping is an extremely rare event ;-)

Then for your sake, I'll post this code:

Code:
boolean purchase(int q, item it) {
	int price;
	switch(it) {
	case $item[magical mystery juice]:
	case $item[Medicinal Herb's medicinal herbs]:
		price = 100;
		break;
	default:
		price = historical_price(it);
	}
	if(stash_amount(it) > 0)
		take_stash(min(stash_amount(it), q- for_use(it)), it);
	if(buy(q- for_use(it), it, ceil(price*1.25)) > 0 || for_use(it) > 0)
		return true; 	// for_use() needs to be checked both before and after that purchase ;)
	return false;
}

Replace the existing purchase() function with this one and it should do what you want. Warning: I have not tested this at all and will not test it either.
 
Then for your sake, I'll post this code:

Replace the existing purchase() function with this one and it should do what you want. Warning: I have not tested this at all and will not test it either.

Thank you, I appreciate it. It appears to be working as expected.
 
Might be some kind of small glitch here. Or else UR wants to make very, very sure I am not beaten up ! :p

[1157] Palindome
Encounter: Drawn Onward

Drawn Onward

You lose 119 hit points
You acquire an item: "I Love Me, Vol. I"

> restore hp

You've had the crap beaten out of you... attempting to find some more crap.
Using 1 personal massager...
You gain 9 hit points
Finished using 1 personal massager.
Casting Tongue of the Walrus 1 times...
You gain 39 hit points
Tongue of the Walrus was successfully cast.
Restoring HP! Currently at 48 of 80 HP, 49 of 79 MP, current meat: 8043 ... Target HP = 80.
_meatperhp => 1.0
Casting Tongue of the Walrus 1 times...
You gain 36 hit points
Tongue of the Walrus was successfully cast.
 
Just looks from your post that Tongue of the Walrus is your cheapest restoration, costing 1 meat per hp restored...
 
Oh wait....the massager is used automatically isn't it ? I was thinking UR had used it to cure the beaten up. I hadn't used my grimoire in so long, I forgot how that worked. My mistake.
 
No. The massager is only used automatically at the end of a battle. That wasn't a battle. It is as Theraze says.

I think UR made the correct decision to make use of your massager since it can only be used if you're beaten up.
 
In that case... tongue of walrus will cure beaten up anyway. Which was the original thing I was wondering about. Why cure beaten up with something else and then use walrus, which is going to cure beaten up anyhow ?
 
Because you needed to heal 80 HP in addition to Beaten Up. Healing Beaten Up is just a bonus.

The massager healed 9 of 80.
 
I see. I guess the line about "You've had the crap beaten out of you..." led me to think it was making a decision about how to cure that, when actually it selected the massager for the hit points it provides. Ah well, I was pretty sleepy when I posted that this morning, and it appears that, having rested, I still am not thinking clearly ! lol
 
Hi, I apologize if this is already in this long thread.

All I want is to use either free disco rest or nuns to heal MP.

I use this script because elsewhere it is stated that the normal restoration does not use nuns because it would overfill MP (I'm wondering why nuns has to behave differently to every other restore, can't you just uncheck it if you don't want it used?)

However, this script will use items in my inventory even though nothing is checked -- and all other methods of restoring mp are not allowed in the relay browser portion of the script. Is this correct behavior? Is there no way to tell it to only use the two above mentioned restores?

Thanks for your help!

Neleus
 
All I want is to use either free disco rest or nuns to heal MP.

I use this script because elsewhere it is stated that the normal restoration does not use nuns because it would overfill MP
Your best bet would be to make your own recovery script, that only considers those two options for MP. If you need help for the scripting, simply open another thread explaining your request, I'm sure a lot of scripters will help.
 
OK...I'm probably being stupid and missing something obvious again, but I'm interested in how the script is making these decisions.
Restoring MP! Currently at 180 of 180 HP, 14 of 186 MP, current meat: 20897 ... Target MP = 28.
Using 1 carbonated soy milk...
You gain 79 Mojo Points
Finished using 1 carbonated soy milk.

If the target is 28 MP, why restore 80 MP ? Is the soy milk cheaper than using an MMJ or something ? Does the script ignore the target if something is cheaper ?
 
What's your current class? Do you have MMJs in your inventory? If you have no access to the MMj store, have you set it to use MMJs from inventory even though you don't have this access?
 
If you are in-run, UR will first consider any item that is already in your inventory, to avoid using meat. It sorts the restorative you already have, weeding out only those which would restore to more than your max MP, and using those which give the most MP first (so they are not wasted).

The goal is to get your MP over the target specified, not to restore to exactly the target amount.
 
Last edited:
Back
Top