OCD Inventory control

Timbatim

New member
I got problems with OCD.
It forgets about options I did before and even worse, it seems to mix the options I have for different characters.

Any ideas for solutions?

After not ascending for a while during crimbo, it stopped behaving like that. I stopped using multiple instances of mafia simultaniously and loaded the ocd configurations a few times before letting it handle the items.
 

taltamir

Member
After not ascending for a while during crimbo, it stopped behaving like that. I stopped using multiple instances of mafia simultaniously and loaded the ocd configurations a few times before letting it handle the items.
If I had to guess, I would say your issue is not due to crimbo, but that this script was not designed to handle someone running multiple instances of mafia simultaneously. The reason it forgets / mixes up options between difference characters is obviously because when you save changes in one character it overwrites the file where this script stores its data, without regard to the fact that a difference version of this file is opened (read: in the RAM) of another instance. which in turn overwrites said file again.

In order to have multiple programs/instances access the same specific file at the same time requires you to implement a database model of data access rather than a simple text
https://en.wikipedia.org/wiki/Database

Although it might be possible to use different files for different accounts and only have OCD load the files specifically matching the account name in question. That way so long as your multiple mafia instances are for different accounts it should work.
 
Last edited:

fronobulax

Developer
Staff member
If I had to guess, I would say your issue is not due to crimbo, but that this script was not designed to handle someone running multiple instances of mafia simultaneously. The reason it forgets / mixes up options between difference characters is obviously because when you save changes in one character it overwrites the file where this script stores its data, without regard to the fact that a difference version of this file is opened (read: in the RAM) of another instance. which in turn overwrites said file again.

In order to have multiple programs/instances access the same specific file at the same time requires you to implement a database model of data access rather than a simple text
https://en.wikipedia.org/wiki/Database

Although it might be possible to use different files for different accounts and only have OCD load the files specifically matching the account name in question. That way so long as your multiple mafia instances are for different accounts it should work.


Ummm... Your last comments describe how OCD does work. Specifically, for the files that it writes, the file names are different for each character.

If a script reads and writes to the same file for all characters then yes, it is possible that the script would end up with files that mix and match data.

KoLmafia has had problems in the past where information from one session/character would "bleed" over to another. If that is happening here then it is a legitimate bug and worth trying to investigate to the point of repeat-ability so it can be fixed.
 

taltamir

Member
Ummm... Your last comments describe how OCD does work. Specifically, for the files that it writes, the file names are different for each character.

If a script reads and writes to the same file for all characters then yes, it is possible that the script would end up with files that mix and match data.

KoLmafia has had problems in the past where information from one session/character would "bleed" over to another. If that is happening here then it is a legitimate bug and worth trying to investigate to the point of repeat-ability so it can be fixed.
thanks for clarifying.
Maybe he is using multiple instances for the same account?
 

taltamir

Member
Ok, this is somewhat odd. Changes to "display" only take effect after I restart mafia. while chinese to mall, autosell, or keep take effect as soon as I hit the save button
 

fronobulax

Developer
Staff member
Ok, this is somewhat odd. Changes to "display" only take effect after I restart mafia. while chinese to mall, autosell, or keep take effect as soon as I hit the save button

That has never been my experience, including yesterday.

Perhaps of interest. For all my characters, I open up the relay browser, select the OCD script and it loads. It reports items as uncharacterized which I know are characterized. I immediately reload the script and the uncharacterized report is then correct. I have found that Weird Things Happen if I do not reload the second time, but if I do reload then everything behaves as expected. I have always suspected some kind of timing issue with my browser - perhaps it starts displaying before it has read the data file completely? - but reloading has always been easier than actually trying to track the cause down.
 
Just now OCD decided to go crazy and sent all my yesterday stuff to "true" user.

Log is full of lines like

> send to mallmulti true: 1 "KICK ME" sign, 30 Angry Farmer candy, 1 Aye Aye, Tooth Tooth, 184 bag of W&Ws, 13 ball, 7 blue mana, 176 box of Dweebs, 5 breakfast mess, 5 breath mint, 12 buckyball, 2 can of sardines
> Sale price for this line: 0

What did I do wrong? What is the solution? Will I ever see my items again? (last question is rhetoric, of course).
...
Hmm, taking into account that "true" was created in 2010 and never visited since then, it's even more rhetoric than I thought. :|
 
Last edited:

Rinn

Developer
Just an fyi, I had issues where the ocd script was getting confused between my main and multi characters, I resolved them by putting the following in my login script:

Code:
cli_execute("zlib BaleOCD_DataFile = " + my_name());
cli_execute("zlib BaleOCD_StockFile = " + my_name());

I never had a chance to look into the root issue since this fixed it.

Just now OCD decided to go crazy and sent all my yesterday stuff to "true" user.

Log is full of lines like



What did I do wrong? What is the solution? Will I ever see my items again? (last question is rhetoric, of course).
...
Hmm, taking into account that "true" was created in 2010 and never visited since then, it's even more rhetoric than I thought. :|

What are your OCD vars set to (run zlib BaleOCD_ in the cli to list them all), something might have gotten mixed up between BaleOCD_MallMulti & BaleOCD_UseMallMulti
 
Last edited:

taltamir

Member
I had an issue where some of the items on my "items to stock" list would be closetted (not all oddly enough the different items would do that... and not consistently. A few days ago my sea cowbells were auto closetted, but today they weren't. A few days ago all 230 of my new age hurting crystal were closetted, but today only 30 were, 30 is the amount i told it to stock... i think something weird is going on with how much i have in stock already vs how much i told it to stock).

Auto closetting those items is a problem for combat items that I specifically put there so I can use them; since you can't use them from the closet.

I tracked down the issue to line 460 through 462 which I proceeded to disable via //
Code:
// Closet everything (except for gear) that is stocked so it won't get accidentally used.
if(it.to_slot() == $slot[none] && stock[it].q - ocd[it].q > closet_amount(it) && item_amount(it) > ocd[it].q)
  put_closet(min(item_amount(it) - ocd[it].q, stock[it].q - ocd[it].q - closet_amount(it)), it);

I am posting this in case someone else has the same issue. Also, I am curious, what is the logic behind autoclosetting stuff on the "items to stock"? The logic doesn't seem to be designed with combat items in mind, so what scenario is it meant for that it would auto closet the stuff?
 

lostcalpolydude

Developer
Staff member
The logic is that you are preparing for a future ascension, so you want to make sure you have those items when you jump through the gash. That isn't nearly as important now that you can buy things from the mall and then pull them mid-run, but there was a time before you started playing when that wasn't possible.

So, the entire "items to stock" feature was made to do something you aren't interested in, and therefore you should probably not use it.
 

fronobulax

Developer
Staff member
There was also a use case where people preferred to stock/sell an item in the Mall rather than use it themselves. This was generally motivated by non-optimal considerations - it was a self generated goal to have an item in the mall for less than market price to "help noobs" or harvest names of active players, for example.

But that does not seem as important or interesting now as it once did so not using the feature seems like the best thing to do with a script approaching it's tenth birthday and an author who seems to have moved on from KoL.
 

taltamir

Member
The logic is that you are preparing for a future ascension, so you want to make sure you have those items when you jump through the gash. That isn't nearly as important now that you can buy things from the mall and then pull them mid-run, but there was a time before you started playing when that wasn't possible.
There was also a use case where people preferred to stock/sell an item in the Mall rather than use it themselves. This was generally motivated by non-optimal considerations - it was a self generated goal to have an item in the mall for less than market price to "help noobs" or harvest names of active players, for example.
Thank you, this is quite interesting to learn.

So, the entire "items to stock" feature was made to do something you aren't interested in, and therefore you should probably not use it.
Thank you, but now that I disabled those 2 lines I noted there, it seems to be working perfectly for the way I am trying to use it (quest / combat item restocker to be ran on prism breaking). I guess I could switch to a combo CLI command that goes something like:
Code:
acquire 3 sea cowbells; acquire 10 sea lassos; acquire 30 new age hurting crystals; acquire 30 new age healing crystal
etc. since acquire only mallbuys if you have less than the number given and only buys up to that target number.
but I find the GUI on this quite convenient. Maybe if more problems crop up.
 
Last edited:

Saklad5

Member
It’d be cool if there was an option to supply custom actions. For example, a “CLI” option that runs a supplied command (or an actual ASH function if that is possible). That would allow users to specify unusual ways to handle certain items, like trading furs to the Trapper.

I’d implement that myself, but I am extremely hesitant to make changes that affect the stored map of a script that might get updated at any point. That seems like a good way to screw up the file.

I have made other changes to the script, by the way. For instance, I have OCD Inventory Control avoid pulverizing any wad-yielding items myself if I don’t have the drill press active.
 
Last edited:

taltamir

Member
potion of temporary gr8tness has at some point lost the t after the 8. This broke some things in mafia, mafia just now corrected it, but this breaks any script that explicitly has mention of it such as OCD.

Here is a fixed version. It also includes my other fixes which are:
1. don't popup a question asking if I am sure I want to run OCD with some items being uncategorized. Uncategorized items will just be ignored, while categorized items will be handled as per your decisions
2. if you set items to auto acquire via OCD, it will not auto closet them. Instead it will keep them in your main inventory where they can be used. (auto closetting was done due to a long obsolete fiddly thing about ascending, and you can't use combat items from closet)
3. shortened filename from "OCD Inventory Control.ash" to "OCDInv.ash". Easier to handle in other scripts and to call from CLI without the spaces and a shorter name.
4. fixed potion of temporary gr8tness => gr8ness thing
5. Possibly some other changes I forgot about.

Download: View attachment OCDInv 2019-08-13.zip

Install instructions:
1. Uninstall OCD Inventory Control
2. Extract zip file into your mafia directory. It will place 1 file in scripts folder, 1 file in relay folder, 3 files in data folder.

all your existing settings and db will remain as is.
 
Last edited:

philmasterplus

Active member
The "keep N" feature doesn't seem to be working for me, at least in aftercore.
I made OCD autosell all tenderizing hammers except 1, yet it always sells the last remaining hammer.
 

fronobulax

Developer
Staff member
The "keep N" feature doesn't seem to be working for me, at least in aftercore.
I made OCD autosell all tenderizing hammers except 1, yet it always sells the last remaining hammer.

I'm weird and almost everything I have done for several years has Keep 1 and it works, in aftercore. Perhaps you could do a little more investigating?

Also note that the script has not been updated since May 2017 and, sadly, Bale is no longer active in KoL.
 

philmasterplus

Active member
Assuming that this script is now "community maintained", can I submit a patch?

The relay script for OCD provides a neat little feature: Clicking on an item name opens the KoL wiki page. Unfortunately, it leads to http://kol.coldfront.net/, not https://kol.coldfront.net/. The wiki does redirect you to HTTPS, but it sometimes results in a broken link. For example, this:
Code:
http://kol.coldfront.net/thekolwiki/index.php/Special:Search?search=Ben-Gal™ Balm&go=Go
...is redirected to this:
Code:
https://kol.coldfront.net/thekolwiki/index.php/Special:Search?search=Ben-Gal%E2%84%A2%20Balm&go=Go

Fortunately, directly linking to HTTPS solves the problem.

The patch was tested on KoLmafia r20582 / browsers Chrome and Firefox.

Edit: This has been integrated into a separate fork. See this thread for discussion on the forked project.
 

Attachments

  • philmasterplus-bale-ocd-wiki-fix.patch
    625 bytes · Views: 3
Last edited:

fronobulax

Developer
Staff member
I'm not sure of the maintenance status. My ability to get SourceForge to tell me who has commit access to a project is severely lacking but I may have it, in which case I will submit later today. If I don't then perhaps it is time to consider a fork, following the pattern established with Universal Recovery (establish a new repository and tweak the entries in the Script Menu to point people to the new one).
 

fronobulax

Developer
Staff member
I'm not sure of the maintenance status. My ability to get SourceForge to tell me who has commit access to a project is severely lacking but I may have it, in which case I will submit later today. If I don't then perhaps it is time to consider a fork, following the pattern established with Universal Recovery (establish a new repository and tweak the entries in the Script Menu to point people to the new one).
I don't have commit access. See discussion elsewhere.
 
Top