OCD Inventory control

Bale

Minion
Seems odd. Are cold wads and twinkly wads list under "Items to Stock"? If not, please post those lines from OCD_txrangersxx.txt
 

heeheehee

Developer
Staff member
Just for the record, this script don't sell using cli_execute() at all, not even with pilcrow notation. It uses put_shop(). The script only uses cli_execute in conjunction with pilcrow only for untinkering and pulverizing. I don't think that there are ash commands for those things.

It's definitely a mafia bug that is causing the issue.

Veracity and heeheehee, should I make a bug report for the problem, or do you have it in hand?

I moved the relevant posts over here.
 
I often had trouble trying to find a specific item with the relay script. I'd end up clicking through various tabs trying to remember which category I put it in, and scrolling though vast lists of items.

So today I bodged in a simple search subcategory under the "Edit Categories" tab.
k1uTZL4.png


Here's the edited version if you want to take a look:
View attachment relay_OCD_dB_Manager.ash

Be warned that I've done no testing apart from checking that it basically works and I can save changes to searched items :)
 

Bale

Minion
Interesting. I never would have thought to implement it like that. Your method is much simpler than the one I would have used.

It's particularly interesting that it allows you to search for items that aren't in your data file at all. That's was probably just a side effect using such a simple method, but I think it might actually be a feature. Or maybe it is a bug. I cannot decide. It's probably a feature to have a method that allows you to add items to the data file even though you do not have one.

I would like opinions from you and others who read this thread. Is that a feature or a bug?

This looks pretty good actually. The only problem I see with your work is that it allows us to add items to the data file which cannot actually be handled by OCD, such as quest items like my evilometer. Simple enough to fix though.

I'm going to look this one over for a day or two and then implement it in some form.
 
Last edited:

Magus_Prime

Well-known member
@Bale - I like what darkcodelagsniper added and would love to see it in OCD. Every time I would open the OCD data file in an editor I found myself wishing for exactly this. I think the unexpected functionality counts as a feature. :)
 

fronobulax

Developer
Staff member
I resort to a spreadsheet to do similar things. A wild card search on item name that would show me the OCD status of an item, including uncategorized would be wonderful. Did I just call something a feature?
 

Bale

Minion
I made some small tweaks to the code posted by darkcodelagsniper, but 98% of it was just his brilliance. darkcodelagsniper, you might find it interesting to see what I changed, but I really owe you for figuring out such a simple way to do something that I was thinking of as complicated. It was honestly fun to search for " barrel" and then telling it what to do about both of the new barrels that I hadn't actually found while adventuring. Adding items I don't own is definitely a feature.

The new feature has been committed, so pleased do an "svn update" and enjoy.
 
Glad I could be of help! :)

Another tweak I think could be nice would be to restore alphabetical sorting for items - both in the relay browser and when OCD is invoked and acts on items. E.g. where now a boolean[item] map is iterated, you would instead iterate over an item[int] map, sorted by value.
 

Bale

Minion
I believe that KoLmafia's default for alphabetical sorting was altered when adapting to deal with multiple items with the same name. You're right that I should do something about it, but its just so pervasive that it would be a PITA to fix.

The solution you propose for the database manager would work the way suggst, but it would be an order of magnitude harder to take care of it for the control script. I'll update the relay script now and start thinking about a good way to handle it for the control.

It has been committed, so update if you want to see it.
 

Bale

Minion
I've been looking over my old code for OCD Inventory Control to consider how it should be alphabetized now that updates to mafia have killed the original simple method. As I do so, I keep wondering what kind of deranged idiot wrote that. I mean, really! It's completely shit!

At this point I'm considering scrapping the old code and starting from scratch. It's just that bad.

Edit: Never mind. I started rewriting it. In the process I figured out why I was dong some of those stupid crazy things. The script makes more sense than I thought. Stupid, yeah, but stupid like a fox! Not rewriting it after all.

At least I did figure out what I'll have to do to make it alphabetize like it used to. Not fun. Maybe I'll do it tomorrow.
 
Last edited:

Bale

Minion
I've made a couple of small tweaks and bug fixes to the new search implementation. It's finished now and I love it! Now when I click on "Edit Database" it goes straight to the "Search" tab and focuses on the text field so I can begin typing immediately.


I do have a question though, for someone whose knowledge of html forms is better than my own. When I hit enter in the text bar of the search it activates the first button (submit) on the page. Why does it do that?

The first button on the page was save. Because of that it was always saving if I typed a search term like, "cuppa" and hit enter instead of clicking the button. There were possible circumstances where that actually cased a problem. I finally fixed that bug with a work-around by adding an invisible button at the top of the page which does nothing. That work-around is flawless, but I would like to know if there was a better or different solution I should have used.
 

xKiv

Active member
I think you need a separate form for each "default" button? Hitting enter is supposed to activate the first submit button in the enclosing form.
 

Bale

Minion
I think you need a separate form for each "default" button? Hitting enter is supposed to activate the first submit button in the enclosing form.

I see. Thank you.

I had tried enclosing the section in a separate <form> </form> and setting the form field, but that kept it from working at all. (Perhaps because of an interaction through the relay browser?) At least, I'm glad to know that activating the first submit button in the enclosing form is expected behavior. In retrospective, perhaps a functional solution would have been to put a <form id="search"></form> field outside of the active form and using the form field in the text box to connect it to that previous form? Maybe next week I'll revisit the code to see if that works.
 

DoctorWeebl

New member
Thank you, darkcodelagsniper and Bale, for this outstanding new search feature. This is saving me a lot of headache and time. :D
 

ganomex

New member
im having an issue with it, when i set the "keep" number for an item (in this case a seal clubbing club) and tell it to autosell the rest through the relay it doesn't save the number to keep but does tell it to autosell them, when i checked mafia's grafical CLI it said the following every time after i hit save
The string ""newq_1=0" is not an integer; returning 10 (relay_OCD_dB_Manager.ash, line 926)
The string "1" id" is not an integer; returning 1 (relay_OCD_dB_Manager.ash, line 927)
The string ""newq_10=0" is not an integer; returning 100 (relay_OCD_dB_Manager.ash, line 926)
The string "10" id" is not an integer; returning 10 (relay_OCD_dB_Manager.ash, line 927)
The string ""newq_11=0" is not an integer; returning 110 (relay_OCD_dB_Manager.ash, line 926)
The string "11" id" is not an integer; returning 11 (relay_OCD_dB_Manager.ash, line 927)
The string ""newq_2=0" is not an integer; returning 20 (relay_OCD_dB_Manager.ash, line 926)
The string "2" id" is not an integer; returning 2 (relay_OCD_dB_Manager.ash, line 927)
The string ""newq_3=0" is not an integer; returning 30 (relay_OCD_dB_Manager.ash, line 926)
The string "3" id" is not an integer; returning 3 (relay_OCD_dB_Manager.ash, line 927)
The string ""newq_4=0" is not an integer; returning 40 (relay_OCD_dB_Manager.ash, line 926)
The string "4" id" is not an integer; returning 4 (relay_OCD_dB_Manager.ash, line 927)
The string ""newq_5=0" is not an integer; returning 50 (relay_OCD_dB_Manager.ash, line 926)
The string "5" id" is not an integer; returning 5 (relay_OCD_dB_Manager.ash, line 927)
The string ""newq_6=0" is not an integer; returning 60 (relay_OCD_dB_Manager.ash, line 926)
The string "6" id" is not an integer; returning 6 (relay_OCD_dB_Manager.ash, line 927)
The string ""newq_7=0" is not an integer; returning 70 (relay_OCD_dB_Manager.ash, line 926)
The string "7" id" is not an integer; returning 7 (relay_OCD_dB_Manager.ash, line 927)
The string ""newq_8=0" is not an integer; returning 80 (relay_OCD_dB_Manager.ash, line 926)
The string "8" id" is not an integer; returning 8 (relay_OCD_dB_Manager.ash, line 927)
The string ""newq_9=0" is not an integer; returning 90 (relay_OCD_dB_Manager.ash, line 926)
The string "9" id" is not an integer; returning 9 (relay_OCD_dB_Manager.ash, line 927)
Item(s) have been categorized.
I have checked folder permissions they are fine, it use to work fine too.
I updated the script today, and I am using the daily build version 17.1 r16339
 

Bale

Minion
That is pretty bizarre. I didn't change anything which should have caused something like that. That even seems to be lines that relate to stocking. Are you set to stock those items? Are you using the item stocking section of this script at all? Could you attach your OCData_name.txt file and your stock file also?

It also might help me out if you did something to print some debugging messages. Please uncomment line 911 if you know how to do that. (Delete the # at the beginning of the line.)


I won't have time to look at that again until Monday. Sorry about the delay, but I'll take another look then.
 
Last edited:

ganomex

New member
I have stock set to " Keep them... if they happen to be in inventory" i tried to find line 911 but there wasn't anything commented out there... which is REALLY weird due to the fact i had just deleted all the OCD and redownloaded the other day when i first had issues, here are my data and stock files and a screenshot of the stock page cus its weird..
 

Attachments

  • OCDdata_ganomex.txt
    58 bytes · Views: 26
  • OCDstock_ganomex.txt
    23 bytes · Views: 32
  • buggy.png
    buggy.png
    24.3 KB · Views: 56
I am another one with the weird OCD error, seems, the same as for ganomex. Unlike him, I see no messages in my OCD, but result is pretty close: now every time when I am trying to save results in OCD dB Manager, it erases all numbers in base. Actually, I erased "use" and "mall" tabs this way (and discovered it on next run when it sent to mall all my inventory), then checked "display" and "stash" tabs to be sure that it still have numbers - and it was - and after that when I tried to move something from "mall" to "keep" (successfully), and saved it, OCD erased remained tabs as well. :/
 
Top