OCD Inventory control

Is this something the script can be configured to do already? - otherwise I guess you can consider it a feature suggestion!

I often find myself losing items I want in pvp (for example smithsness gear, li'l unicorn costume or gingerbread smartphone), and I'd like the script to automatically reacquire them if that has happened.

I don't know if there's an easy/intuitive way to implement such a feature in the UI, but just wanted to throw it out there and see if anyone agrees!
 
Last edited:
Code:
setvar("BaleOCD_StockFile", my_name());    // The name of the file that holds OCD stocking data for this character.
Have you looked into the stocking file?
 
I've thought about writing a script that scans my pvp log and automatically re-acquires anything that was stolen. Does anyone know if such a script has already been written?
 
I keep everything over 100,000 meat closeted so that on login I can restock items that cost less than 100,000, can be equipped, are tradeable and available_amount and closet_amount are 0. I suppose the downside is that it only notices when the last item has been stolen.
 
I've thought about writing a script that scans my pvp log and automatically re-acquires anything that was stolen. Does anyone know if such a script has already been written?

This is one I've put together for these purposes. It prints everything that's been stolen in the current season, and tries to acquire those out of which none are remaining, up to a configurable maximum price. It could be adapted to just reacquire everything regardless of the price if you wanted to.

I haven't been able to make it work with longer archives, but it works nicely for me. I've been trying to find the author of the functions used for printing to give them credit, but i haven't been able to find them. If someone knows, please let me know!

View attachment LostItems.ash
 
Last edited:
I'm sure it's because of some matching skills I'm lacking, but I've tried to use it to analyze past season's archives, for example, and it just hangs. I may be wrong but I get the feeling that it's because of the larger buffer length.
When I use it for the current season only it works like a charm.
 
Last edited:
I have no idea if this is the place to put it, but OCD doesn't know that the robortender drops are crafting ingredients, and as such, the 'craft into a ...' option can't be selected in the dropdown, any chance this could be fixed so that I can actually start turning my excess drops into high quality booze automagically?
 
Cannot replicate. OCD does give me the option to craft my fish heads, so perhaps you could tell me exactly which items are giving you trouble?

VMo6nph.png


Edit: OCD takes its information from mafia's data files, so if it has been a really long time since you updated mafia then you should do that to update mafia's information.
 
Last edited:
e20286aaae.png


All of them, including the fish head. (all being the robortender drops and the first tier drinks you can craft from them).
I download the daily build every day, so mafia should be up to date but who knows, what file does it look at for this info?

Edit: use_for_items.txt in the data folder has last been updated 17-05-17.
 
Last edited:
I download the daily build every day, so mafia should be up to date but who knows, what file does it look at for this info?

It looks at concoctions.txt which is included inside kolmafia.jar so if you've updated to the latest daily build you have it. Unless you've got a file in your /data file called concoctions.txt (which would override it), in which case you should delete that immediately.
 
Hmm, strange, I don't have an override and concoctions.txt does seem to be up to date with the robortender recipes (and the murderbot ones as well).
 
I completely removed bale-ocd (svn remove and then I deleted the folder from ~/svn/, I kept my settings though), and then reinstalled it, which seems to have done the trick.

I still dunno what the problem was, maybe it failed to update correctly at some point.
 
noob problem probably

hullo bale!

so I just installed this script. but when I tried to call it from the Scripts tab, I got this in the CLI:

> call scripts\OCD Inventory Control.ash

Updating inventory...
autoSatisfyWithCloset => false
All item information is corrupted or missing. Whoooah! I hope you didn't lose any data...
autoSatisfyWithCloset => true

OCD Control was unable to obssessively control your entire inventory.
Requests complete.

what am I doing wrong?
 
what am I doing wrong?

To elaborate upon what txrangersxx just said, in case it wasn't detailed enough for you...

In the relay browser, look at your top menu. In the lower-right hand corner you'll see a drop-down menu titled "- run script -" which you need to click on. Select "OCD dB Manager" and then you'll see a new interface appear in KoL's main window. Start telling OCD what to do with your items. Note that there are default values for most items. If you aren't too picky, selecting that will save a lot of time.
 
So I know this might not be the thread for it (but cant find one by Zarqon for this particular script) and since I haven't looked at it in ages, nor really kept up to pace with the development of the OCD-script in general: Is there a way to make Zarqons PAtoOCD-script include what is in Hagnks and similar?
Most of the time I'm using a system which for some reason can take several minutes to perform a single Mall-search, but sometimes I find myself on a system which can go through my full inventory in just a few minutes! So now that I'm on a system which is really fast I was thinking I'd give a full scan a go. The problem is that I'm in the middle of a HC run and by the time I am out if it I will no longer be on this faster system.
The PAtoOCD-script only really look at the stuff in my inventory. Can I add something somewhere to make it include stuff found anywhere (including Hagnks, what I'm wearing, Closet, etc)? Maybe add something in the foreach-loop "foreach it in get_inventory()"?

Code:
// PAtoOCD.ash
// by Zarqon
// adds PA's recommended course to OCD for all items not currently in your OCD database
// Like it?  Send batbits!

import <zlib.ash>
import <priceadvisor.ash>

int keepgear = 2;                // keep equipment
int keepother = 5;               // keep non-equipment
int keepvalue = 100000;          // keep all of anything worth more than this

record ocd_data {
   string act;
   int keep;
   string info;
}[item] ocdata;
if (!file_to_map("OCDdata_"+my_name()+".txt",ocdata) || count(ocdata) == 0) file_to_map("OCD_"+my_name()+"_data.txt",ocdata);

price_advice course;
foreach it in get_inventory() {
   if (ocdata contains it) continue;
   ocdata[it].keep = (to_slot(it) != $slot[none]) ? keepgear : keepother;
   course = best_advice(it,true);
   if (mall_price(it) >= keepvalue) ocdata[it].act = "KEEP";
    else switch (excise(course.action,""," ")) {
      case "smash": ocdata[it].act = "PULV"; break;
      case "use": ocdata[it].act = "USE";  break;
      case "autosell": ocdata[it].act = "AUTO"; break;
      case "mallsell": ocdata[it].act = "MALL"; break;
      case "untinker": ocdata[it].act = "UNTN"; break;
      case "make":
      case "acquire": if (contains_text(course.action,"make ")) {
            item tomake = to_item(excise(course.action,"make ",";"));
            if (tomake == $item[none]) { ocdata[it].act = "KEEP"; break; }
            int[item] ings = get_ingredients(tomake);
            if (count(ings) == 0 || !(ings contains it)) { ocdata[it].act = "KEEP"; break; }
            ocdata[it].act = "MAKE"; ocdata[it].info = to_string(tomake); break;
         }
      default: ocdata[it].act = "KEEP"; break;
   }
   print("Added "+it+" ("+item_amount(it)+"): "+ocdata[it].act+" "+ocdata[it].info+" (keep "+rnum(ocdata[it].keep)+")");
}
if (map_to_file(ocdata,"OCDdata_"+my_name()+".txt")) print("OCD map updated for "+my_name()+". Please check the above output to make sure nothing stupid was done.");
 
You could change this:

PHP:
foreach it in get_inventory() {
   if (ocdata contains it) continue;

to this:

PHP:
foreach it in $items[] {
   if (have_item(it) + storage_amount(it) == 0) continue;
   if (ocdata contains it) continue;

That will run the code for all items you have in inventory OR storage.

The downside of running this code mid-run is that get_ingredients() doesn't return anything if you're currently not able to use the creation method required, so items could get flagged KEEP that PA would normally recommend to be MAKE.
 
Back
Top