Profit -- get an accurate meat/adv estimate for a given zone

zarqon

Well-known member
[size=+1]Profit 1.1[/size]

What is it?
Profit simply tells you useful farming information about a given zone. Most importantly, it gives you a "meat per adventure" number, which is based on your current item and meat drop rates. It also tells you the most profitable monster in a zone.

Average expected item profit is calculated by taking the item's drop rate times the item's value. Nontradeable items are not included. You can change the use_autosell variable to true to use autosell value rather than mall price in this calculation, in which case any item with a positive autosell value is included.

Noncombats are all treated as being entirely profitless. This means that the number will be low for areas with profitable noncombats (such as the Treasury).

Bonus meat from the following familiars is averaged in: NPZR's, hobo monkeys, and Cocoabos. The script assumes that your CCS will take full advantage of these familiars.

Known Shortcomings
  • This uses mafia's data, so in cases where drop rates are missing or inaccurate, the script will be too.
  • Unfortunately, this also means that monsters that drop multiple identical items will always be treated as if they only drop one of that item. This means that the Goomba is seen as more profitable than the Blooper, because even though the white pixel is the most valuable pixel, the Goomba drops three unique items, whereas the Blooper appears to only drop one white pixel.
  • Profit does not take into account pickpocketing or other means of increasing item drops while in combat.

How to use it:
  • Download profit.ash to your scripts directory.
  • Make sure you also have ZLib.
  • Run the script either from the CLI ("call profit location") or from your scripts menu.
  • Profit! Seriously.
  • This script can also be imported. The central function returns a float (meat per adventure) which may be useful to other scripts.

Changelog
9.01.09 - ver. 1.0 posted.
9.02.09 - ver. 1.1 changes: ignore shirts if you lack Torso. Account for familiar meat for NPZR's, hobo monkeys, and Cocoabos. Add flag for using autosell value rather than mall value.
 

Attachments

  • profit.ash
    4.8 KB · Views: 315
Last edited:
I was actually thinking of writing something like this but it looks like you beat me to it, nice work :D

EDIT: I hope this comment didn't offend anyone, I didn't mean to :( I removed the potentially offensive part.
 
Last edited:

Spiny

Member
This is probably gonna come back and slap me in the face with a big ol DUH, but where is the script taking into account the number of adventures to spend in its calculations?

-Spiny
 

Rinn

Developer
The data files actually show multiple item drops of the same item, it's just they can't have two entries in a map that use the same key so only one is returned. You could actually parse the monsters data file to get an accurate list, or request a different function or a fix to the current one.
 

Muhandes

Member
Great script, thanks.

One thing I noticed is that it takes the mall price for items, even if said items are sold at min price. The problem is that to sell these you'd have to invest quite a bit in advertising, and I think most people just autosell them. Maybe the autosell value for those should be taken instead?
 

zarqon

Well-known member
@cow_guru: Ha, not at all offensive, the variable name is definitely silly. Glad you like the script.

@Spiny: the script does not calculate anything based on number of adventures spent. Its averages are based on the appearance rates of monsters/noncombats. It's a projection, not a post-analysis.

@Rinn: Sigh, looks like data file parsing in the next version. I was hoping to avoid that.

@Muhandes: so, you'd rather an option for calculations to be based on autosell? That's easily doable. Will put that in the next update. Any items with no autosell value will be calculated as worthless, though.

Anyone know how I might factor the current +/-combat rate into this? In other words, if I have an encounter rate of +2.0%, does that mean I can just subtract that from the noncombat percent given in appearance_rates()?
 

asturia

Minion
Thanks for this script.

Is it possible so that the script takes in account the noncombats calculated by kolmafia?
At the moment it assumes 10% noncombats, but I'm running +15% noncombats. So the calculations are a bit off.
 

zarqon

Well-known member
Looks like I kind of ninja'd you.

I'll also try to be adding in the estimated meat from hobo monkeys, NPZR's, and Cocoabos. I don't think that adding in boa constrictors, dreidls, or dice would be worth it, so I'll probably skip that.

The monkey is easy (75 meat each time), but the others need calculating. The data on the Wiki about farming with a NPZR is from before the 10th-round meat cutoff.

EDIT: Okay, I know there are people on this forum who are better at math than I am. If we assume 10 rounds, with the NPZR having an 11% chance of stealing (6*weight)+10 meat each time, what is the average meat yield for one combat? Can I just take 1.1 * (6*weight)+10)? (Which I suppose would simplify to 6.6*weight + 11).

EDIT 2: Posted an update including familiar bonus meat. Correct my math if it's wrong, please. Also, ignores shirt drops if you don't have the Torso skill. Also, includes an option to use autosell value of items rather than mall price.
 
Last edited:

Muhandes

Member
@Muhandes: so, you'd rather an option for calculations to be based on autosell? That's easily doable. Will put that in the next update. Any items with no autosell value will be calculated as worthless, though.

I was actually thinking of something a little more complicated. If the mall price is min price (100 or twice autosell) then take autosell. Otherwise take mall.
 

Metraxis

Member
Looks good. you have some nice features, and a number I didn't include in mine. You may want to have a peek at it to see if you can adapt the olfaction code to your style.
 

DaMaster0

Member
I got an error:

Undefined reference to function 'appearance_rates' (profit.ash, line 51)

I don't see appearance_rates in either this script or zlib. I do have the latest version of zlib and mafia. What am I doing wrong?
 

Bale

Minion
iIs the build different?
What you are referring to is the latest release release. Between official releases mafia is under continuous development. Frequently new features are added like appearance_rates() which are eagerly applied by script developers like zarqon. If you use scripts on this site, you'll often need to update your mafia build since we like playing with the newest toys.

That's the whole reason for this forum here. I mean, what did you think all those announcements of new SVN changes were about?
 
Looks good. you have some nice features, and a number I didn't include in mine. You may want to have a peek at it to see if you can adapt the olfaction code to your style.

I had a go at this - it's not trivial since some zones have funny rates for different monsters. I just flat assumed that the rates were 1/n, where n is the number of relevant monsters in the zone. That should be correct for standard zones.

On that note, I think that in the report generating part of the original script, the count(menage) calls include semi and ultra-rares, so the numbers printed are a bit out for zones containing them. I haven't changed those since I'm not sure (very new to this scripting business!).

I also took the opportunity to alter the autosell code to autosell only if the item's mall value is at minimum (also as per Metraxis' script).

Thanks very much to both of the script authors for their hard work!
 

Attachments

  • profit_mod.ash
    6.1 KB · Views: 62

Theraze

Active member
Tweaked the (original) script slightly to use item_drops_array, so that it accounts for monsters that drop the same item multiple times. This still has the same issues where pickpocket-only items are still considered as available even if you don't have pickpocket, etc. This does fix the issue with 8-bit zone that zarqon notes in the first post...
Evaluating monsters based on current meat/item drop rates...
white pixel (80 @ +195.90416): 391 meat * 100.0% = 391
white pixel (70 @ +195.90416): 391 meat * 100.0% = 391
white pixel (60 @ +195.90416): 391 meat * 100.0% = 391
Blooper avg. value: 1173.0 meat.
black pixel (50 @ +195.90416): 100 meat * 100.0% = 100
white pixel (50 @ +195.90416): 391 meat * 100.0% = 391
red pixel (65 @ +195.90416): 480 meat * 100.0% = 480
Buzzy Beetle avg. value: 971.0 meat.
black pixel (50 @ +195.90416): 100 meat * 100.0% = 100
red pixel (80 @ +195.90416): 480 meat * 100.0% = 480
white pixel (50 @ +195.90416): 391 meat * 100.0% = 391
Goomba avg. value: 971.0 meat.
red pixel (70 @ +195.90416): 480 meat * 100.0% = 480
red pixel (70 @ +195.90416): 480 meat * 100.0% = 480
red pixel (70 @ +195.90416): 480 meat * 100.0% = 480
Octorok avg. value: 1440.0 meat.
Interestingly, red pixels are now the most expensive, making the Octorok better than the Blooper or Goomba. Anyways... if someone has suggestions on what I should try to tweak here next, let me know. :)

To enable item_drops_array, stackval now uses a monster instead of item_drops(monster) so the whole array gets considered.

Edit: Got bored and added pickpocketsallowed() to the script. It checks for if you're in a moxie class or have the tiny black hole equipped. If that's worked, it then looks for legendary regalia of the groovelord, to see if you have two pickpocket attempts. If you don't have it, return 1. If you do have it, check each part and see if it's equipped. If any parts are not equipped, return 1. If everything is equipped, return 2.

As part of this change, it should now examine drop type. If it's "p" then it only uses the base item drop chance <code follows>. If it's "" then it does boosted drop rate plus... well, let me just give the relevant code. It appears to give the same results (for one) as mafia, so I think I've got it right, but this also adjusts if you have the groovelord outfit equipped, so it should be a bit more accurate for comparisons. :)
Code:
      if (type == "p") {
        if (ppa < 1) return 0;
        modrate = rate;
        if (ppa > 1) for i from 2 to ppa modrate += rate * (100-modrate) / 100;
      }
      else if (type == "") {
        for i from 1 to ppa modrate += rate * (100-modrate) / 100;
      }

Edit2: Fixed a bug where it was adding pickpocket benefits to non-pickpocketing characters. Should be fixed now for the two who have grabbed it so far.
 

Attachments

  • profit.ash
    5.5 KB · Views: 54
Last edited:

Theraze

Active member
As before, but with skipping beer lenses. Believe this has more accurate pickpocket detection than profit_fx does...
 

Attachments

  • profit.ash
    5.6 KB · Views: 49
Top