OCD Inventory control

(it also provides some direction as to what to do with those items, as often people don't know what the most profitable course of action is)

So I was thinking about that, and it seems like Price Adviser would be nice for people who want suggestions about what the most profitable course of action is.

However, the PA->OCD script goes a bit overboard, taking some of the OCD out of it and not letting people make item-by-item systematic choices. So, would it be possible to have a column that displays the PA suggestion for what to do with an item when categorizing items? (And possibly for already categorized items)

I realize that that'd be a decent bit of work and understand if you don't want to do it. (And for all I know, PA somehow works in a superior manner, I honestly have no idea how it works.) But 'tis my suggestion nonetheless.

Also:

Run OCD twice. Once with the default data and once with NCF data.

From my understanding, that's *not* a solution. Say there's an item a that people b wants to keep all of. So his OCD data says "keep this item". The NCF data might say "Go auto sell all of item a". Running it again with the NCF data would override the person's settings. My understanding of what you're meaning could well be flawed, of course, but that's how I see it.

If I were doing this and I couldn't pass a map, I'd make a new temporary file with the merged data. Not the best solution, but it'd work. Assuming I'm understanding the problem right. Which I may well not.
 
Last edited:
Morg, the problem with that is it could take 10 minutes between when you click to load the script and when mafia finally delivers a page to the browser. PA sometimes needs to search a huge number of mall prices to figure out the best action for an item, and when you multiply this by an entire inventory, it can take quite a while. Like, a go-to-the-bathroom-and-get-a-snack while. Perhaps mafia keeps the request alive somehow (doubtful), but most browser timeouts are shorter than that. I originally added a PA column to my version of OCD back in the day, but it was waaayyy too annoying so I took it out.

A workaround would be to run PA on your entire inventory prior to running the OCD manager, without doing anything (ash import <PriceAdvisor.ash> foreach i in get_inventory() best_advice(i,true);). Then when a PA-including version of OCD was run, it wouldn't need to do all those mall searches since they would still be cached, and the page could load without waiting for hundreds of mall searches.

All this to say, it's a decent idea (I especially like the idea of highlighting actions you have already chosen which differ from PA's advice), but I strongly doubt Bale is going to want to deal with the complications, given that he probably already has all of his items nicely categorized.
 
@Morgoth: I thought of that, and thought about ways to get around it (ie: merging the data), but in the end I decided that I'd try it out and see what happens. The NCF (well, Harvest now actually, since I changed the name) data is only used if your farming location is set to the Giant's Castle, and it only deals with items you can find there. Very few people are going to want to do anything other than mallsell/autosell/pulverise castle items. Collectors would already have OCD configured to send the items to their DC, and I can't think of any situation in which somone would want to keep a pile of castle items in their inventory. The worst that could happen is that someone 'loses' the sell/buy difference on a day's worth of semi-worthless junk xD
 
From my understanding, that's *not* a solution. Say there's an item a that people b wants to keep all of. So his OCD data says "keep this item". The NCF data might say "Go auto sell all of item a". Running it again with the NCF data would override the person's settings. My understanding of what you're meaning could well be flawed, of course, but that's how I see it.

If I were doing this and I couldn't pass a map, I'd make a new temporary file with the merged data. Not the best solution, but it'd work. Assuming I'm understanding the problem right. Which I may well not.

True. I much prefer your solution. Banana Lord, I suspect that you're the only one who wants to run OCD this way. Is there some reason you don't want to create a temporary file with the merged data?
 
I'd prefer to keep the number of data files Harvest uses to a minimum. As it is I'm using 5. But yes, I agree that it's the best solution. I'll look into it next week when I'm free. For now I think it'll run OK.
 
Feature request: "Propose a trade to..." action setting. This'd work in the same way as kbay auctions, with a field equivalent to "minimum bid", and with trades only being sent when there are enough items to be worth it.
 
I understand the desire and I've considered this, but I'm not going to do this. It troubles me that I cannot ascend if I have any outstanding trades and that gets in my way. Sorry, but you'll have to manage your own trades.
 
I wasn't able to ascend once because of an outstanding trade when my trading partner had logged off before approving the trade. I had to choose between a stuffed Hodgie and ascension. I'll never forget that sad feeling. :(
 
Bale,

Is there a way to add all items that mallsell for min price as autosell without actually adding them all manually?
 
ok, thanks for the quick answer.

I decided it wasn't too troublesome, so I wrote a script that should do what you requested:

PHP:
import "zlib.ash";

record {
	string action;	// What to do
	int q;			// How many of them to keep
	string info;	// Extra information (whom to send the gift)
	string message; // Message to send with a gift
} [item] OCD;
string OCDfile = "OCDdata_"+vars["BaleOCD_DataFile"]+".txt";
file_to_map(OCDfile, OCD);

foreach it in $items[]
	if(is_tradeable(it) && autosell_price(it) * 2 == mall_price(it))
		OCD[it].action = "AUTO";
		
map_to_file(OCD, OCDfile);

If you've already got an entry for that item it won't change the number to keep. Otherwise the number to keep will be zero.

WARNING: If only 5 items in the mall are at minimum price, then it will still autosell the item even though that might not be good. That's why this isn't recommended.
 
Last edited:
Morg, the problem with that is it could take 10 minutes between when you click to load the script and when mafia finally delivers a page to the browser. PA sometimes needs to search a huge number of mall prices to figure out the best action for an item, and when you multiply this by an entire inventory, it can take quite a while. Like, a go-to-the-bathroom-and-get-a-snack while.

Ah, good point. I wasn't thinking about that.

A workaround would be to run PA on your entire inventory prior to running the OCD manager, without doing anything (ash import <PriceAdvisor.ash> foreach i in get_inventory() best_advice(i,true);). Then when a PA-including version of OCD was run, it wouldn't need to do all those mall searches since they would still be cached, and the page could load without waiting for hundreds of mall searches.

Alright, I'll look into that.

Edit: According to PA: "Moreover, it will not consider anything you cannot currently do because you lack the skill or access to the equipment or are the wrong gender." I don't see anything on that page to disable that, does anybody with more experience know how?

Edit (again): Does there happen to be a way to have a url like the descitem one that gets its content from a specific function in the relay script? Such as, instead of http://127.0.0.1:60080/desc_item.php?whichitem=504849907 as the url, http://127.0.0.1:60080/relevant_info.php?whichitem=504849907 which would display things such as all the Price Advisor output and other OCD-relevant info.

If not, is there some ash scripting version of the PHP htmlspecialchars function? I'm using a javascript alert to display all of the PA output currently, but that breaks if the item has an apostrophe in the name.

Both solutions would work, but the former would be preferred. 'cause I like having control.
 
Last edited:
Not to be pushy or anything but...anybody? I am new at poking around ash scripts, and a brief look at the function list on the wiki didn't answer my question. (Though I may have missed it easily, obviously.)
 
url_encode()/url_decode()?
entity_encode()/entity_decode()?

I don't know PHP, so don't recognize the function you mention.
 
Last edited:
Looks like entity_encode() is functionally identical to htmlspecialchars(). So that answers that. And yeah, sorry, I probably should have also described the function.

Also, it looks like KoLMafia is keeping the request alive for me while it's doing the bunch of searches with Firefox 5. (Figured may as well test that, worst thing that could happen is the request times out.)

Edit: Argh...it's *almost* functionally identical. htmlspecialchars() also converts " and ', entity_encode() doesn't seem to.

Edit (again): Oddly enough, doing even a string replace of single quotes to the html code for single quotes doesn't work. Nor did my test of doing a javascript alert with a message like: A 'quote' is <b>bold</b> (Which should become: A 'quote' is <b>bold</b>)
Removing the single quotes made it work, however. Does anybody have any suggestions? (I know, this is a strange problem only barely tangentially related to the OCD script...)
 
Last edited:
I use OCD in my farming script, but if I happen to have an item that hasn't been categorized, it will hang waiting for me to respond. It would be nice if you could implement a variable 'OCD_Ask_Recat' or something like that, so that it could bypass this question. For now, I have just commented out the question statement.
 
Back
Top