OCD Inventory control

Bale

Minion
There is already a method for running this as part of farming with unknown items. I don't know if your script is ash or cli. If you are running a cli script you'd call my script like this:

Code:
ashq import <OCD Inventory Control.ash>; ocd_control(false);

If your script is ash, then I'm sure you know how to convert that. (Remove the "ashq" and put the import part as the first line in your script with ocd_control(false); wherever you like.)
 
Wow...I stumbled across this Bale from looking at your signature on another thread, and I'm glad I did. This could save me tons of time at the end of each hardcore run. Normally I'd just let stuff accumulate for maybe 10 runs before I'd get around to cleaning up some of it...but this script should really help keep my inventory clean and manageable. :D
 

Banana Lord

Member
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've put together some (slightly tested) code which I think should accomplish this, but as OCD is, naturally, your area of expertise I thought it'd be wise to run it past you before releasing it as part of Harvest. Thanks for your help :)

Code:
int run_ocd()
	{
	announce(2, "run_ocd");
	
	// If farming castle and want to use default data, merge OCD data files
	if(DEFAULT_OCDDATA && FARMING_LOCATION == $location[giant's castle])
		{
		load_current_map("OCDdata_HAR_Default", default_ocd_data);
		
		string ocd_file = "OCDdata_"+ vars["BaleOCD_DataFile"] +".txt";
		file_to_map(ocd_file, temp_ocd);
		
		// Ignore any items for which the user has already set actions
		foreach data in default_ocd_data
			{
			if(temp_ocd contains data)
				announce(3, "You have already set an action for "+ data); // Do nothing;
			else
				{
				// Add the default action to the temporary map
				announce(3, "Using default data for "+ data.to_string());
				temp_ocd[data].action = default_ocd_data[data].action;
				temp_ocd[data].q = default_ocd_data[data].q;
				temp_ocd[data].info = default_ocd_data[data].info;
				temp_ocd[data].message = default_ocd_data[data].message;
				}
			}
		
		// Save the resulting map to file
		map_to_file(temp_ocd, "OCDdata_HAR_Default.txt");
		}
		
	int ocd_profit = ocd_control(false, "HAR_Default");

	return ocd_profit;
	}

Oh and is there a way to improve lines 22-25 ("temp_ocd[data].action ... [data].message;")?

EDIT: I was going to post this earlier, but never got around to it. I keep seeing "The message didn't send for some reason" errors.
Code:
> call scripts/Inventory/OCD Inventory Control.ash

Saving outfit: Backup
Outfit saved
Taking off everything...
Everything removed.
use 1 Degrassi Knoll shopping list

pulverize 3 cold powder, 3 hot nuggets, 3 hot powder, 4 sleaze powder, 3 stench powder, 75 twinkly nuggets, 3 twinkly powder

The message didn't send for some reason.
Asked wadbot to malus some wads.
display 1 time helmet

Placing items in display case...
kBay "VIP Klaw Stuffies" 7 stuffed Baron von Ratsworth @ 1000, 4 stuffed key @ 2000, 2 stuffed Meat @ 1000, 8 stuffed mink @ 1000, 7 stuffed monocle @ 1000, 4 stuffed teddy butler @ 1000, 3 stuffed tin of caviar @ 1000, 11 stuffed treasure chest @ 2000
Minimum bid for this lot: 61,000

Minimum biding for all auctions = 61,000
The message didn't send for some reason.

Minimum biding for all auctions = 61,000
Putting on outfit: Backup
Equipment changed.
Anticipated monetary gain from inventory cleansing: 122,000 meat.
 
Last edited:

Bale

Minion
That should work. Amusingly, I've actually been thinking about adding the feature you desired into my script. Enough people use Harvest that it seems a worthwhile feature to add. ;)


Oh and is there a way to improve lines 22-25 ("temp_ocd[data].action ... [data].message;")?

temp_ocd[data] = default_ocd_data[data];

It's call by reference which has been tormenting zarqon lately, but that doesn't hurt you at all. :D


EDIT: I was going to post this earlier, but never got around to it. I keep seeing "The message didn't send for some reason" errors.

Uh. Weird? Has that been consistent lately as if something changed in how KoL processes message sending?
 

Banana Lord

Member
Haha. Ah well. Native support is always better than 3rd party, and I'm sure the practice did me good xD How're you thinking of doing it, just out of interest? Default data bundled into OCD itself, auto-merging data from a specified data file or something else?

Huh. Really? I tried that first but got an error (something about not being able to store an anonymous record in an anonymous record).

Semi-consistent, I think. I haven't been paying that error much attention lately as I've been more focussed on getting bounty hunting working in Harvest, but I'm fairly sure it's sending some of the time. Actually... Don't quote me on this but I seem to remember seeing that error and then discovering that the message had actually sent fine. I'll have a look through my session logs and see if I can turn up anything useful.
 

Bale

Minion
Haha. Ah well. Native support is always better than 3rd party, and I'm sure the practice did me good xD How're you thinking of doing it, just out of interest? Default data bundled into OCD itself, auto-merging data from a specified data file or something else?

Send it the file name and it would merge the data for you.
 

Banana Lord

Member
Oooh nifty. I'm doubly glad I decided to cut corners and not add a temporary data file for the merged data now :D

OK, I lied. The error has occurred every day since June 16th inclusive (as printed on my session log, so my time I think), but never before then that I can tell. As I don't have a buildup of items in my inventory I assume that the message has been sending at least some of the time. Look at these readouts:
June 16th said:
send a kmail to wadbot: 23 giant needle, 2 rave whistle, 14 wolf mask
> The message didn't send for some reason.
June 17th said:
send a kmail to wadbot: 25 giant needle, 5 rave whistle, 7 wolf mask
> The message didn't send for some reason.
If the message hadn't sent, you'd expect OCD to try to send roughly twice as many of each item on the 17th. What's weird is that the whistles and the masks look doubled, but the needles don't. Something else that strikes me as odd is that OCD is not pulverizing the items before sending them, even though my main has that ability and a tenderizing hammer. That may be intended behaviour of course (it's another matter as to whether or not OCD should pulverize before sending). On the other hand, if I run OCD now it still refuses to send, as per my earlier post, and the items definitely do stay in my inventory.

EDIT: I've found a handful of days on which twice the normal number of wolf masks were sent to wadbot, but only one on which the number of needles was doubled (I didn't bother to check the whistles because so few of them drop anyway). I can't make much sense out of that, how about you? :confused:
 
Last edited:

Banana Lord

Member
No further progress, I take it?

On an unrelated topic, for some reason OCD keeps trying to mallsell my hipposkin poncho even though I have it configured to keep one.
 

Bale

Minion
No idea. I have not been able to replicate that bug.

You weren't clear about one thing: Did the message actually send despite the error message? Did wadbot return wads to you?
 

Banana Lord

Member
From what I can see it's sporadic, sometimes it does, sometimes it doesn't. The error came up today when Harvest ran, and that left ~130 twinkly nuggets in my inventory. When I ran it again just now it didn't display the error and sent them off just fine. For the last couple of weeks I've just been letting Harvest burn my adventures and looking at my inbox I've received a return message from Wadbot every 2-3 days (Harvest calls OCD every day, as you probably know, so I should have received one every day).

One other small thing, the blue informative statements that OCD prints out often run well past the right-hand edge of my mafia window, is there any chance you could have it put the text that gets chopped off onto a new line?
 

Bale

Minion
One other small thing, the blue informative statements that OCD prints out often run well past the right-hand edge of my mafia window, is there any chance you could have it put the text that gets chopped off onto a new line?

If it runs off the right-hand edge, then you have another script printing something unusual like webpages. Regular print statements automatically wrap at the right-hand edge if the right-hand edge hasn't been pushed that way. "cls" before running OCD and it won't happen. I really don't want to count characters and calculate how many will fit on your window. (I'm pretty sure I can calculate screen width based on your properties.) That's a whole pain in the ass I'd have to go through. Or you can just type "cls" in the CLI before running OCD.
 

Banana Lord

Member
Ah, right you are. It was some debug stuff from Harvest, and cls is a very useful command to know. I can remember wishing for something just like that a number of times. Thanks!
 

Banana Lord

Member
I figured out what the issue with the poncho was. It was my fault for trying to take a shortcut while merging the two OCD data files (normal one and the one supplied with Harvest). Without going into more detail, it'd be lovely if you decided to roll auto-merging into OCD after all :)
 

Bale

Minion
Yeah, I know I said I wasn't going to add that feature yet, but I did anyway. Just because I'm a pain in my own ass.


OCD Inventory Control Updated!


This changes the purpose of second parameter. I'd basically added the second parameter ages ago because Banana Lord wanted to make it configurable by the script, but his vision of what he wanted got changed. Now I'm changing the meaning of the parameter to suit Banana Lord's current vision. I don't think anyone else uses the two parameter version so I doubt it will hurt them. If I'm wrong, oops, something will be worked out.

Now the second parameter is an extra OCD file whose contents will be added to the character's OCDdata file. If an item is in both files, then the character's OCDdata will be used. Call it like this:

Code:
ocd_control(FALSE, "OCDdata_HAR_Default");

Notice that I didn't add the .txt to the end of the filename. Your file needs to have the .txt extension though.
 

Sputnik1

Member
As in, the message "Uncategorized item(s) have been found" still appears.
When the code reads this...

Code:
import <OCD Inventory Control.ash>
cli_execute("OCD Inventory Control.ash"); ocd_control(false);
 

Bale

Minion
Don't do it that way. Try it like this instead:

Code:
import <OCD Inventory Control.ash>
ocd_control(false);

Nothing has changed. Your method never would have worked.
 
Last edited:
Top