SmartStasis -- a complex script for a simple CCS

Bale

Minion
Information for zarqon: So far spading shows that the stocking seems to follow the exact same formulas as the coacoabo, so it should be handled the same way. It does everything the coacoabo does and it does it in the same way. It just has a few extra things that your script doesn't need to support.
 

zarqon

Well-known member
2.1

Stocking support, everyone.

Also, it now considers the monster element when deciding to stasis with a rock lobster or midget clownfish.

I'm envisioning a reworking of this eventually where I actually use formulas. The code will be bigger but run faster and more accurately. But it will be annoying to write so I don't expect that to happen soon. :)
 

slyz

Developer
Just a little note to say I ascended as a DB for crimbo and started playing with with SmartStasis and the disco combos. I found that using a meat per mp of 8 (cost of in-combat mp) is a little high. I changed it to 2.9 (that's what Bale's Universal Recovery is buying mp for, with magi-wipes).

Maybe I'll play around with Bale's script and make it output a meat per mp as a Mafia/zlib property that SmartStasis can use. I guess this kind of knowledge (the cost of mp or hp) could have other uses, although I can't find any right now.

I'm just throwing this idea in here in case it gets Zarqon or Bale interested. We have all seen what happens when a problem needs solving and you two start to tango around each :D
 

zarqon

Well-known member
Interesting. I suppose we could do a

if (can_interact() && contains_text(get_property("recoveryScript"), "Universal_recovery")) meatpermp = 2.9;

Because unless someone is using Bale's script there's no guarantee they will get that value.
 

Bale

Minion
I'm very happy to know that my script is helping people get 2.9 meat/mp instead of 8. ;)

zarqon, obviously in the middle of combat you cannot check mall prices, but if the character is a mysticality class or a level 9 AT, you can obviously check the price of mmj and assume that as a good basis for meatpermp. Average restoration is 100 meat/ (my_level() * 1.5 + 5.0), so for a level 8 character that's already 5.9 meat/mp. For higher levels it continues to plummet. That should effect hardcore stassising.
 

Bale

Minion
Then please ignore my redundancy.

I started thinking... what if there was a preference, _meatpermp that my script sets. If the value isn't blank, then you'd know that someone was running my recovery script, and that is the current value of an mp.
 

zarqon

Well-known member
That would be great, actually. Let's do it!

I think you should make your script set it every time, and then SS will set it only if it's blank. (Because other scripts may want to access this setting.)
 

Bale

Minion
That works for me. I think I should only set it if the character is in mallmode since restorative prices in hardcore are kinda obvious and irrelevant. Then you can do what you want with that. I think it should be a daily setting since we wouldn't want it to be too persistent.

I want to work out all the details here before I add the feature. It would be bad to implement it thoughtlessly.
 
Last edited:

zarqon

Well-known member
I can dig that. Ideally you should set it, whether mallmode or no, to the actual value that your script is providing. If your script also calculates a meatperhp value, that would be useful as well for my still-in-development combat script.
 

Bale

Minion
It wouldn't be at all hard to do _meatperhp at the same time.

Ideally you should set it, whether mallmode or no, to the actual value that your script is providing.
If the script isn't in mallmode, what would the value of hp or mp be based on? My script is not providing any answers to that question. Obviously mall price is irrelvant, so I don't know how to calculate it.
 

zarqon

Well-known member
In HC/Ronin, calculations should be based on the cheapest renewable restores, not dropped restore items, since acquiring such an item also requires farming or pulling from storage, which increases the cost by an indeterminable amount. Calculation of renewable restores is probably mostly the same as what's already in SS.

But once acquiring an item does not require farming/pulling (i.e. you have mall access), mall price is completely relevant, since the cost of replacing those items is no more than mall price -- whether your script is set to buy those items from the mall or not.

So probably the best option for can_interact() is to set it to the restore value that the script actually gets when it runs, calculated based on mall price. For example, if someone with mall access had turned off buying items, and the script chose to use a restore item from inventory rather than buying a more efficient restore item, the restore cost value would still be based on the mall price for the item used.
 
Last edited:

Bale

Minion
Your script already needs to have that logic. So there's no point to adding it to my script just so that your script can use it instead of its own copy. I'd just be copying your efforts for no advantage to either script.

As for the rest, I've already added it to my script to automatically calculate _meatperhp and _meatpermp on first run of the day regardless of actually purchasing anything. (It also sets them any time it needs to recalc them.) Took only 9 lines of code to add that.

If you find those variables unused, it means the user isn't using my script or else he's in hardcore so you can go with your script's internal logic for figuring out those variables and set them yourself to improve efficiency on successive runs. My own script will gladly reset them even if you're using them.

How's that sound?
 

zarqon

Well-known member
Excellent. Those will be floats, naturally. I'll write some handling for this into the next SS update.
 

Bale

Minion
Floats? Well, actually they'll be strings consisting of the characters 0-9 with a decimal point in it. However the value would be useful if converted to a float. ;)

PHP:
	float cost;
	if(best_item == $item[magical mystery juice] || best_item == $item[Medicinal Herb's medicinal herbs])
		cost = 100.0;
		else cost = historical_price(best_item);
	if(type == "MP")
		set_property("_meatpermp", to_string(cost/ heal[best_item].avemp));
		else set_property("_meatperhp", to_string(cost/ heal[best_item].avehp));

That should be fine. It gets set on first run of the day and every time it becomes relevant for healing.
 
Last edited:

Bale

Minion
Umm... no. Silly me. That'd make it a bit more complicated to figure out meatperhp. I'll work on that.

Anyway, I already noticed a little problem with this.

Code:
[COLOR="Olive"]> ash get_property("_meatpermp").to_float()[/COLOR]

Returned: 2.9636364

[COLOR="#808000"]> ash get_property("_meatperhp")[/COLOR]

Returned: 7.000001E-5

[COLOR="#808000"]> ash get_property("_meatperhp").to_float()[/COLOR]

Unexpected error, debug log printed.
Returned: void
meatperhp can get very low when curing a lot of hp with a scroll of drastic healing. What should be the solution?
 

slyz

Developer
I guess I got you two interested :D

Deciding if using a disco combo is worth it is one use of _meatpermp, but I still can't find any good use, especially in-combat. Maybe deciding if pickpocketing is worth getting hit once, or deciding if casting a buff is worth spending the mp when farming... but those are pretty niche I guess.

Anyway, seems like it wasn't such a difficult thing to add to those two already excellent scripts.

Thanks !
 

zarqon

Well-known member
Calculating the cost of attack skills (in meat) is one very significant use. Calculating income from restoring familiars is another.

But these are just pieces of the puzzle -- endgame for me is calculating the profit/cost of one round of combat given a particular action, which becomes much easier once everything is converted to a meat value.
 
Top