Looking for a library ...

gemelli

Member
I've been making extensive use of the skill_to_effect() function lately. I was wondering if there's a function available that does something similar for items that produce effects when used (e.g., the super-spikey hair gel). It wouldn't be hard to write a simple mapping table ... but I thought I'd check here first on the off-chance that this already exists in some form.

Any suggestions? Thanks!
 
No. I believe Retrofrog's Charpane Recast script for Greasemonkey has the most complete mapping, though, in case you needed a reference table from somewhere. :)
 
Got it, thanks :) I'll post my functions when I finish converting the data over.

One more question as long as I'm here ... I am also interested in evaluating what equipment "slot" a given item would naturally equip to (if it actually equips to a slot). Is there a built-in function in Mafia to allow me to do this? Since this information is clearly available to the equip() function, I'm hoping there is something that could be exposed to an ASH script as well.

Again, it won't be hard to make a function to do this if the functionality doesn't already exist, but I hate doing work that's already been done :) Thanks again!
 
item_to_slot found at the very bottom of the page? if this function does not exist or has different functionality, please let me know and I will remove it from the wiki or make the needed changes.
 
I forgot about that function, and admittedly, it comes close. That function is really lazy about accessories, and always returns acc1, even if KoLmafia might naturally equip it to acc2 or acc3 if they're empty, so it's not perfect.
 
Many thanks!  That function is absolutely perfect for what I need ... I owe you one :D

EDIT: I created two functions in ASH: one for converting items to effects, and the other for going the other way. I don't think these are perfect -- for one thing, there are almost certainly effects and items missing. For another, I wasn't able to come up with an elegant way to handle multiple results, so if you call getItemFromEffect($effect[sugar rush]) you will only get one of the items that could produce that effect. That being said, please feel free to use these functions if you think they might be useful.
 

Attachments

Nice! As I was reading the post an idea struck me though. For effects which come from various items you might check item_amount and return the item which the user has the most of, with a default return if the user has none of them which would be the one that is normally cheapest in the mall, or easiest to farm.
 
Back
Top