OCD Inventory control

Ferdawoon

Member
I recommend clicking save after ticking the boxes.
I am =(
Well, right now I ticked all the boxes in the Crafting and clicked Save. I then tried some things:

* Go to another sub-category and then back: Still ticked.
* Go to another main category, then back to Crafting subcategory: Still ticked.
* Go to my inventory (in the webbrowser ofc) and back (via stock items or it wont let me go to Crafting): Still ticked.
* Closing the KoL frame in my browser and then let Mafia start a new one: Still ticked
(did not have to go to Stock Items to get to Crafting this time tho!)
* Closing Mafia completly and restarting: Still tagged.

However, I just realized that I did have two items not categorized (seems Mafia don't always add new items to the inventory just by me going to the Message page to see what my Pen Pal have got me today). So I Add those with PAtoOCD as ususal and test again =)

I go to the Information tab and then back to Crafting. All the tagged boxes are now cleared.


Testing more I tick them all again and click Save.
Going to Information and back, still tagged. Going to Stock Items and back. Still tagged.
Going to the inventory and back. Still tagged. Closing the browser tab and starting a new one. Still tagged.
Relogging mafia, Still tagged.

Hmm further testing:

If I just uncetegorize a random autosell item (acid squirting), test some stuff, it all seem to stay tagged. If I add it myself, everything stay tagged.
If I am in the relay and let PAtoOCD add it for me, the things turn un-ticked if I just switch to Info and back to Crafting..

At this point I also dont have to go to Stock Items as often as I did before. It seems to be fixed atm

So, it seems to have to do with if I add something to the list with PAtoOCD. Still using Chrome so could be a part in that.
 
Last edited:

Ferdawoon

Member
Ok, opened up my IE for the first time in ages, just for you! Feel special ;-)

Anyway, using IE 9. The only browser except Chrome that I have installed.

I still cant get to the Crafting page without first loading an item, either from Add Item or Stock Items tabs. First time going in to Crafting, they are all untagged. Tagging all and clicking save.
Moving between tabs in the relay, no change. It stay tagged.
Restarting IE (since Mafia was my only tab in it) and loading it again, everything tagged.

Going straight for the part that seemed to cause the bug. So, uncategorizing Acid squirting flower from Autosell again, and things stay tagged. Manually adding it as Autosell again, it stay tagged.
Uncategorizing it again and using PAtoOCD to sort it out.. There seemed to be a thing there. I was still at the Autosell sub category when I used PAtoOCD, went straight to Crafting and it was still tagged. I went to the Add Item tab then Information tab and then back to Crafting. It is now untagged.

I tried it again, tagged all and saved, uncategorized the acid squirting flower again and moved around. Staying tagged. Adding it manually, staying tagged.
Uncategorizing it again and letting PAtoOCD add it (while still on the Crafting sub-cat) then going Closet sub-cat and back to Crafting. It is now untagged.

So it seems to happen in at least both IE9 and Chrome 18.sumthin'sumthin'.
 

Ferdawoon

Member
Well, what my PAtoOCD looks like
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 = 1000000;          // 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;
   if (to_slot(it) != $slot[none]) ocdata[it].keep = keepgear;
    else ocdata[it].keep = 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.");

It could be as simple as running it fiddles something with just the Don't Buy tickboxes.
 

Bale

Minion
The first thing I note is that there is a definite bug related to it being based on a very early version of OCD. The following code is WRONG!

Code:
record ocd_data {
   string act;
   int keep;
   string info;
}[item] ocdata;

That will definitely remove the "Don't buy" tickboxes. You need to change that to:

Code:
record ocd_data {
   string act;
   int keep;
   string info;
   string message;
}[item] ocdata;
 

Ferdawoon

Member
Well the script is from a year ago or something so no wonder it is a bit outdated =P

I did the change to it and tried it again, by again uncategorizing Acid squirting flower and let PAtoOCD update it for me. With the change, the boxes stay ticked =)
Seems, with some very minor testing, that the little change to the code solved the tickbox problem!

Do you think Zarqon will be pissed if I upload my now edited copy here for those who use it to update it?
Well, here it is! <3 Zarq for it =D
 

Attachments

  • PAtoOCD.ash
    2 KB · Views: 44

Bale

Minion
See! I told you ages ago that it was probably a problem with PAtoOCD! You should have posted your code back then.

I'm 100% sure that zarqon will be the opposite of pissed about you posting your copy here.
 

Ferdawoon

Member
See! I told you ages ago that it was probably a problem with PAtoOCD! You should have posted your code back then.

I'm 100% sure that zarqon will be the opposite of pissed about you posting your copy here.

I havent coded for 10 years, and even that was Visual Basic and a bit of Java =P
I guess I still see things from a newbie user point of view and not so much from a programmers point of view =D

Cheers for the help!
 

Theraze

Active member
Emm... two problems with this, both actually the same problem. Being that it's based on an OLD version of OCD, it still has the data files hardcoded... 'modern' OCD uses a BaleOCD_Datafile variable to decide where the actual data lives. If you're using the default location, this won't be a problem, but if you're using multiple sets of data or shared data, the 767 PAtoOCD will cause you issues by categorizing a different datafile than you're actually using.

Either fix that in your 767 downloaded copy, or use the following, which also saves 3 on equipment items by default (2 one-handed weapons plus a disembodied... who knows, maybe it'll happen) and saves anything above 100k instead of 1m by default, because I'd rather not sell my un-reclaimable items without actually realizing it and the Crimbo rewards are often priced in the 400-600k range.

Otherwise (the two keep-changes and actually reading Bale's OCD variable in both spots) my copy is identical to Ferdawoon's 767 edition.
 

Attachments

  • PAtoOCD.ash
    2 KB · Views: 59

mellissaleo

New member
Today, I got a surprise from the OCD script. Which was a surprise in itself, because the script does such an awesome job.

I ran it in simulation mode, just to check something. But apparently in the process of simulation the entire contents of Hangk's actually got emptied into my inventory.
I understand why OCD would take everything out of Hangk`s, with all crafting and stuff it can do, even though my logic on that might be a bit different. What I find counter-intuitive is the fact it takes stuff out of Hangk`s storage even in simulation mode.

I searched this (quite long thread) to find some references to how OCD is meant to handle pulling stuff from Hangk`s (since I`m not nearly good enough in reading code to understand that from looking at the scrip itself). I found two contradicting statements.

It ignores stuff in either Hangks or the closet. (Unless you tell it to empty your closet -- that's an option.) SO it is easy to hide stuff from OCD's eye.

Actually, my script will empty storage for you. (It checks lastEmptiedStorage to see if it should.)

I would appreciate just a little bit of explanation of the script`s logic regarding Hangk`s, so that I can work with it.


And to explain a little bit the point of view from which I am approaching this... Since the pvp revamp, I prefer to just leave everything in Hangk`s, because closeting takes ages. I was expecting I could use the script on stuff in my inventory only, and then just before ascending I would pull everything and run OCD one more time. If that is not the logic of the script that is perfectly fine.

Still, simulation mode should only simulate, right?
 

Bale

Minion
The problem is that it won't simulate properly if stuff is left in Hangks, so it pulls all the stuff from Hanks even if you're simulating... Of course you have completely valid concerns, so I can't ignore them.

I think I can fix it to meet your expectations and I'll work on that. I'll probably add a zlib variable to not empty Hangks.
 

mellissaleo

New member
I do not mean to get you to make changes.
I didn`t realize that the script can`t simulate properly without pulling everything from Hangk`s. Which is, now that you point it out, quite logical.
I can work with it, now that I know it. As far as I am concerned, a note next to the check-box for Simulate only explaining it would be just fine... eg. (no actions will be taken, but if you have things left in Hangk`s they will be taken out)

On the bright side, apparently I don`t have that many items that are both stealable and valuable. I still have a chunk of items to sort in OCD, and I was getting worried I`ll have to wait till I get bored with pvp to sort them. But now I can get back to it right now thanks to your script emptying my storage!
On a not so bright side, I killed another Hodge yesterday, and yet again he didn`t drop a stuffed version of himself. One of these days I`ll get that stuffed Hodgman for you!
 

Bale

Minion

mellissaleo

New member
Yep, that thread is how I found out that so little items of value have no flag that makes them unstealable, which made me so happy :) Thank you, though, for making an effort to point me to it :)

And thank you again for your script and your scripting magic :)

I certainly do not expect you to make simulate work with Hangk`s. It is so niche, and honestly, with the protection script, I don`t think I will be leaving all my stuff in Hangk`s anymore, anyway.
 

Bale

Minion
OCD Inventory Control Updated!
Relay OCD db Manager Updated!

  • BRICKO pants, hat and sword can be broken into component BRICKOs
  • Discardable Items: useless powder, burst hellseal brain, shredded hellseal hide, torn hellseal sinew, Instant Karma

Listed above are items that can be discarded even though they cannot be autosold. If I missed any, please tell me.

I haven't fixed the un-Hagnking problem that mellissaleo reported. It's something I'm aware of, but it might be a while until I get to it.

Mafia may not be aware that you have broken your BRICKO gear into BRICKOs. This is a mafia bug.
 
Last edited:

bsander

Member
This really is an awesome script and Ive been using it for months with great pleasure. I do have one feature request though: an item search function. Sometimes I want to check what rules I have set for a specific item, so I have to click on all each of the tabs (keep, closet, mall, etc.) and use my browser's page search function to find it. It would be great if there was a textbox in the relay script somewhere that matches all categorized items based on a wildcard search!
 

fronobulax

Developer
Staff member
I have wished for something similar but since the data file can be opened as a text file or a spreadsheet I tend to do so as an alternative.
 

Bale

Minion
This really is an awesome script and Ive been using it for months with great pleasure. I do have one feature request though: an item search function. Sometimes I want to check what rules I have set for a specific item, so I have to click on all each of the tabs (keep, closet, mall, etc.) and use my browser's page search function to find it. It would be great if there was a textbox in the relay script somewhere that matches all categorized items based on a wildcard search!

I appreciate the need, but I'm not likely to add it since it will take me a good bit of work and I make do with a text editor, like fronob does. I'm not even entirely sure how I would add that.
 
Top