Session results

Banana Lord

Member
How do I call data from the session results pane? For example, how would I get mafia to tell me what my meat gained value was?

Thanks!
 

StDoodle

Minion
You don't, exactly. You have a couple of options; add a login script that records meat you have on login, and compare it later to your current total... but that won't tell you what you've spent. For complicated stuff, you'd need to write a routine that applied some regex-fu to the results of ash's session_logs(). I just tried it myself, but the large number of "unrecognized item" strings made me think twice...

Edit to add:

This should work:

PHP:
string [int] res = session_logs(1);
int minus; int plus; int tmp;
foreach x in res {
   tmp = extract_meat(res[x]);
   if (tmp < 0) {
      minus = minus +  -1 * tmp;
   } else { plus = plus + tmp; }
}
print("Meat losses: " + minus);
print("Meat gains: " + plus);
print("Net change: " + to_string(plus - minus));
But I still get a pretty full CLI first...

Edit the 2nd;

Well, it "works" in that it matches the session results, but doesn't work in the sense that the numbers are wrong in both places due to meat gain / loss text being interpreted as "Unknown item" by KoLmafia. Wonder if it's wonkiness from using the latest daily with preliminary combat macro support?
 
Last edited:

Banana Lord

Member
Hmm. Yes I considered comparing login/current meat, but you've already mentioned the limitation there. My scripting's not up to the alternative though, so I'll stick with that and work on some basic logic to estimate my expenditures. Thanks anyway!
 
Top