MPA Scriptlet

Raven434

Member
Urgh.

Not enough coffee this morning.

I am trying to do research to write a small scriptlet that will calculate the MPA {Meat Per Adventure} for a day's adventures.

I know from a logic perspective it should basically look like this:

Meat Gained / Advs Used = MPA

What I am missing in perusing various online resources, invoking 'ashref', etc. is how to put these 2 pieces of information together.

I also looked at the huge body of work our many submitters here have offered to see if I could pare down some of their more complex pieces.

Ideally, it would simply say
"You MPA for today was 888". Your ValueofAdventure variable is set for 779"

I know this is simple but I am having complete brain cramp on putting this together.

I know a better way to do it would be to account for possible crashes, etc and write a $STARTING_MEAT value out somewhere and at the end of the run do the delta on ($FINISHING_MEAT - $STARTING_MEAT) / Advs Used

Thanks.
 

jasonharper

Developer
So what exactly is the problem? my_meat() and my_turncount() give you the information you need, just subtract the starting value from the ending value.
 

heeheehee

Developer
Staff member
I think he wants this to be an end-of-the-day script, rather than a turn-burning script.

If there's some way to grab the session results and parse that (I know there's the CLI command >summary, but how do I capture that to a string?), it'll solve the problem at hand.
 
Well, one solution would be to use the saved-variable idea. Call one script at the beginning of the day which saves meat and turncount (from my_meat() and my_adventures()) to settings or zlib vars, call a different one at the end of the day which reads them, calculates the difference between the saved and current values, and calculates mpa. (Or the same script, with different arguments to indicate which operation to perform.)

This does rely on you not doing any turn-generating-activities between calls so that the difference in my_adventures() actually reflects how many adventures you've spent. I don't believe Mafia has any sort of my_turncount() function.

If you're not accounting for crashes you could put this stuff in login and logout scripts; if you are you'd run them manually.
 

Bale

Minion
That solution is fairly simple, but it has another serious flaw which cannot be planned for.

So what exactly is the problem? my_meat() and my_turncount() give you the information you need, just subtract the starting value from the ending value.
Not really. If you sell anything in your store, then that meat will quietly show up in my_meat() when the charpane is refreshed. It will be indistinguishable from meat gained from combat.
 

heeheehee

Developer
Staff member
Well, you have to somehow account for the profit of items, right? And not all items are just autosold/used.
 

zarqon

Well-known member
I already log daily meat gain in a map for some clan bots so I can assess the performance gain of farming tweaks. Nothing new to suggest, other than 1) use mafia once-daily variables (like "_dailyMeat"), and b) set the properties in your login script after eating/drinking/spleening (or not spleening, if you farm your spleen drops).

These bots don't have stores though, since they use our clan Treasury-bot, which is in all ways better than store/stash combined! (my best script, in my opinion)
 

mredge73

Member
These bots don't have stores though, since they use our clan Treasury-bot, which is in all ways better than store/stash combined! (my best script, in my opinion)

Quit teasing!
I have been trying to write one of those for some time now but I know you won't release your clan bot work for me to cheat off of.
 

zarqon

Well-known member
Yeah I've only released 1 of 3 clan bots publicly. (It's about to get another update, too!) I won't share the Treasury script, but I will be happy to answer whatever questions you may have about making your own! Not here though -- don't want to threadjack.
 
Top