OCD Inventory control

I found that thanks Bale. Just then :D Love it! Any way of having OCD auto-wad via wadbot? I've got my own, somewhat inefficient, code in my logout script to do it, but still... I feel bad asking for more, but PA would be sweet. And is there a way to remove items from the database? Or, more specifically, not items, but the pesky entry described as "none". I was tempted to just delete that line from OCD_Banana_Lord_Data.txt, but then I thought no... Maybe I'll wait to see what Bale has to say before I do something horrible to myself :P

Oh, and just for clarification. Under the mall tab, setting "Keep" to 1 mallsells all but one of that item. What does it do under "Display"? Display only one, or display all but one, keeping the other in inventory? Both of those would be handy functions, but I'd like to know which, if either, the script does.
 
Last edited:
Is there a PriceAdvisor option (do what PA says is most profitable)? If not, there should be (and I could send you some code you could adapt for it).

I was thinking about writing a secondary script that will create a OCD data file based on PA. Then you could look over the data file and see if you agree with PA's choices before running inventory control with those options. If you want to write any code for that I'd be rather grateful. I've never actually used PA for anything and I'd love to see your code using it.

Perhaps the best way to do it would be to add a "categorize unknown items with PA" button to the relay browser. Along with a button on each category to "remove all these items from the database" so that they can be removed and quickly recategorized. Or maybe it should be one button to remove all pulverize, autosell, mall items and re-categorize them with PA? Feedback on this would be helpful. If anyone wants to describe the most helpful way to integrate this into the script and its user interface, I am listening eagerly.


I found that thanks Bale. Just then :D Love it! Any way of having OCD auto-wad via wadbot?

Thanks. I've had pulverize so long that I forget about the simple things like this. I ought to put that into this script. How is wadbot used? Do you need some special format to the message? Please advise me.

And is there a way to remove items from the database? Or, more specifically, not items, but the pesky entry described as "none". I was tempted to just delete that line from OCD_Banana_Lord_Data.txt, but then I thought no... Maybe I'll wait to see what Bale has to say before I do something horrible to myself :P
Huh? I don't have any entry called "none" in my data file. I don't know anything about that bug. Could you copy-paste that here?

BTW, the way to remove normal items is to set their action to unknown. That'll remove them.

Oh, and just for clarification. Under the mall tab, setting "Keep" to 1 mallsells all but one of that item. What does it do under "Display"? Display only one, or display all but one, keeping the other in inventory? Both of those would be handy functions, but I'd like to know which, if either, the script does.

It does the same thing for display. It will keep 1 in inventory and display the rest.
 
Wadbot's used via kmails. This's probably the best way of me explaining it to you ;-) The most awkward thing I found when trying to code it was how to avoid sending non-multiples of 5 powders and wads (since they just get returned anyway), without resorting to sending more than one kmail. I sort of compromised by only allowing the script to send one kmail a day to wadbot. I'll be interested to see what no doubt elegant and annoyingly simple solution you pull out of the box :-)

From the data file:
Code:
none	KEEP	0
I assumed there was a bad entry in OCD data creator, but I couldn't see anything obvious.

EDIT: Oh and I've got pulverise too, so the main utility of wadbot (apart from speed) for me is wadding when I haven't got access to the malus.
 
Last edited:
So, I should just send a blank kMail to wadbot with all the items and what-not appended? Sounds easy to use. Here's my simple solution to your problem:

Code:
boolean wadbot(int [item] pulverize) {
   foreach thing, quant in pulverize
      if(thing.to_int() > 1437 && thing.to_int() < 1450) {
         quant -=  quant %5;
         if(quant < 1) remove pulverize[thing];
      }
   kmail("wadbot", "", 0, pulv);
}

You should be able to remove that none entry without ill effect. I think I know how it got there although it isn't in my data, so I'll add a check for it in the update. (I think saving data when there's nothing in data might do that.)
 
Last edited:
First, let me relocate my lower jaw. Twice. What a lovely UI, Bale.

@zarqon
The major problem I found with PriceAdvisor while writing a cleanup script of my own is that determining the best method of liquidating a set of items using various methods available is very, very difficult. Item A may be best liquidated after being cooked with Item B, but Item B would be better off being mallsold as it is. Also, the best method of liquidating Item C involves acquiring Items D through G, two of which are cooking ingredients and one is untinkerable and meatsmith-able. Oh, did I tell you that using Item C has a fractional chance of yielding 4-5 items? And that Item G can be pulverized, but that it is untradeable and thus requires buying a tenderizing hammer?

Even if we had a recursive algorithm that could find the best method, it would simply take too long to compute and possibly not work at all; from my experiences, KoLmafia doesn't like recursions above ~250 levels. (I really should attend more CS classes though.)

In the end I had to be satisfied with a comparison between autosell, mallsell, pulverize, multi-use crafting, and single-use "package opening." And had to implement it myself, because parsing PriceAdvisor output in ASH scripts is rather difficult.
 
Updated with new version of both OCD Inventory Control and the relay dB Manager.

I changed relay script's name to "OCD dB Manager" because it describes the relay script better and removes the confusion of having two scripts with the same name.

There's a bunch of little changes to fix bugs I found and I added version checking to the relay script.


First, let me relocate my lower jaw. Twice. What a lovely UI, Bale.

Thank you very much. I'm quite proud of it. :D I spent a good bit of time on it and learning enough CSS to create that UI was a major undertaking for me. I just knew that I wanted the UI to use tabs, then I googled for it started dissecting a lot of CSS until I figured out how to do it with lists and buttons.

If anyone figures out a good way to use PA here, please let me know. So far, it sounds like your solution would be to parse PA personally and copying it into the OCD database.
 
Would it be possible to just add autosell vs. mallsell to give a rough guideline of what would be best? Even historical_price() might be enough (in order to avoid doing a server hit for each item). If the minimum price in the mall is very close to the autosell value that indicates that one might as well autosell it.
 
I use this to automatically upgrade all powders and nuggets to wads. It sends a single kmail to wadbot with only multiples of 5.

PHP:
void do_wads() {
   int[item] bits;
   void add_it(item hmm) { if (item_amount(hmm) > 4) bits[hmm] = floor(item_amount(hmm)/5)*5; }
   for i from 1438 to 1449 add_it(to_item(i));
   add_it($item[sewer nugget]);
   add_it($item[floaty pebbles]);
   add_it($item[floaty gravel]);
   if (count(bits) > 0) {
      vprint("Upgrading all powders/nuggets...","blue",2);
      kmail("wadbot","wads",0,bits);
   }
}

I also use PA like this (roughly, I took out some parts) for StashBot's inventory maintenance. This code comes from inside a function where which is the item being considered. Note that for items where there's a series of actions, it only performs the first action, since the later actions (on the resultant items) will be handled in the next iteration (StashBot runs every 2 minutes).

PHP:
   price_advice course = best_advice(which,true);
   print(course);
   if (index_of(course,":") == 0) return;
   switch (excise(course.action,""," ")) {
      case "": vprint("No profitable actions for "+to_plural(which)+"!  Skipping.",3); return;
      case "smash": cli_execute("send "+howmany+" "+which+" to wadbot||wads"); break;
      case "use": cli_execute("use "+howmany+" "+which); break;
      case "autosell": vprint("Autoselling "+howmany+" "+which+" @ "+course.price+"...",3);
                       cli_execute("autosell "+howmany+" "+which); break;
      case "mallsell": vprint("Selling "+howmany+" "+which+" @ "+ip+"...",3);
                       cli_execute("mallsell "+howmany+" "+which+" @ "+ip+" limit 0"); break;
      case "untinker": vprint("Untinkering "+howmany+" "+which+"...",3);
                       cli_execute("untinker "+howmany+" "+which); break;
      case "make":
      case "acquire": if (contains_text(course.action,"make ")) {
            item tomake = to_item(excise(course.action,"make ",";"));
            if (tomake == $item[none]) vprint("Unable to determine item to be created.",0);
            int[item] ings = get_ingredients(tomake);
            if (count(ings) == 0) { vprint("You cannot currently create any "+to_plural(tomake)+".",-2); break; }
            if (!(ings contains which)) vprint(which+" is not an ingredient of "+tomake+".",0);
            if (create(floor(howmany/ings[which]),tomake)) {}
            break;
         }
      default: vprint("No programmed course of action for this command.",0);
   }

I was not thinking of anything very "integrated", as far as adding PA to the OCD dB (decibel??) script. I was simply thinking of making that one of the options. In other words, the action dropdown would contain "autosell, mallsell, smash, send as gift to..., PriceAdvisor" and so forth. Users would probably select this for items that they don't care too much about, but which may have varying results depending on the state of the market.
 
I use this to automatically upgrade all powders and nuggets to wads. It sends a single kmail to wadbot with only multiples of 5.

PHP:
void do_wads() {
   int[item] bits;
   void add_it(item hmm) { if (item_amount(hmm) > 4) bits[hmm] = floor(item_amount(hmm)/5)*5; }
   for i from 1438 to 1449 add_it(to_item(i));
   add_it($item[sewer nugget]);
   add_it($item[floaty pebbles]);
   add_it($item[floaty gravel]);
   if (count(bits) > 0) {
      vprint("Upgrading all powders/nuggets...","blue",2);
      kmail("wadbot","wads",0,bits);
   }
}

The just released v3.1 uses wadbot for wadding, if you lack malus access, as Banana Lord requested. However I forgot about sewer wads and floaty stuff. I'll have to add that in for v3.2
 
Have I stuffed up, or is there a bug in the latest version? I'm not sure why it's trying to send things to my mall multi, as I haven't asked it to do so (and that beautiful new UI doesn't show anything as being amiss).

Code:
pulverize 6 Bonerdagon necklace, 1 Boss Bat britches, 11 Drowsy Sword, 12 Lord Spookyraven's ear trumpet, 4 badass belt, 1 easter egg balloon, 3 giant needle, 1 glowing red eye, 11 obsidian dagger, 3 rusty chain necklace, 3 sawblade shield
 
pulverize 3 wrench bracelet
Unable to invoke 6
 
send to mallmulti Monkey Lord: 5 "DRINK ME" potion, 2 1337 7r0uZ0RZ, 6 30669 scroll, 5 33398 scroll, 1 7-Foot Dwarven mattock, 1 8-ball, 1 ASCII shirt, 39 BRICKO brick, 3 BRICKO eye brick, 1 Black No. 2, 1 Hippy Army MPE
 
send to mallmulti Monkey Lord: 9 Imp Ale, 1 Knob Goblin elite helm, 1 Knob Goblin elite pants, 1 Knob Goblin elite polearm, 3 Knob Goblin firecracker, 1 Knob Goblin harem pants, 1 Knob Goblin harem veil, 1 Knob Goblin perfume, 1 Maxwell's Silver Hammer, 2 NG, 1 PADL Phone
 
send to mallmulti Monkey Lord: 14 Spam Witch sammich, 1 Swabbie™ swab, 5 Tasty Fun Good rice candy, 1 Tom's of the Spanish Main Toothpaste, 3 Trollhouse cookies, 1 Typical Tavern swill, 2 Wand of Nagamar, 1 Zim Merman's guitar, 1 acoustic guitarrr, 2 all-purpose cleaner, 1 anti-anti-antidote
 
send to mallmulti Monkey Lord: 1 ballroom blintz, 1 barbed-wire fence, 1 barrrnacle, 1 baseball, 2 bat wing, 4 beer bomb, 1 beer helmet, 1 black kettle drum, 1 black pepper, 1 black picnic basket, 1 bone rattle
 
send to mallmulti Monkey Lord: 1 bottle of Monsieur Bubble, 1 bottle of alcohol, 8 bottle of rum, 2 bottle of vodka, 3 bottle of whiskey, 2 bowl of cottage cheese, 2 briefcase, 2 broken skull, 1 bronzed locust, 1 bubbly potion, 2 canopic jar
 
send to mallmulti Monkey Lord: 1 chef's hat, 2 chrome ore, 2 cloudy potion, 4 cocktail napkin, 4 cocoa eggshell fragment, 5 coconut shell, 1 cool whip, 1 corpse on the beach, 1 costume sword, 1 cracker, 7 cranberries
 
send to mallmulti Monkey Lord: 1 curmudgel, 1 dark potion, 1 dead guy's watch, 1 demon skin, 1 digital key lime pie, 2 disease, 1 disintegrating quill pen, 1 distressed denim pants, 1 dope wheels, 2 drum machine, 2 dry noodles
 
send to mallmulti Monkey Lord: 1 drywall axe, 2 dusty bottle of Merlot, 3 dusty bottle of Pinot Noir, 1 dusty bottle of Zinfandel, 2 effervescent potion, 1 enormous hoop earring, 1 evil golden arch, 1 eyepatch, 1 f3d0r4, 2 fancy bath salts, 1 fancy but probably evil chocolate
 
send to mallmulti Monkey Lord: 1 ferret bait, 1 fizzy potion, 2 flaming talons, 1 flute of flat champagne, 1 frigid ninja stars, 1 funky dried mushroom, 1 gas balloon, 15 gauze garter, 5 ghuol ears, 1 ghuol egg, 1 ghuol guolash
 
send to mallmulti Monkey Lord: 1 giant cactus quill, 1 giant discarded plastic fork, 1 giant pinky ring, 1 glass of goat's milk, 3 glimmering roc feather, 1 goat beard, 3 goat cheese pizza, 6 gob of wet hair, 1 gremlin juice, 2 grouchy restless spirit, 1 handful of hand chalk
 
send to mallmulti Monkey Lord: 2 handful of sand, 2 handful of sawdust, 1 handsomeness potion, 1 headhunter necktie, 1 heavy metal thunderrr guitarrr, 1 hellion cube, 3 hot katana blade, 1 hot plate, 4 hot wing, 1 hypodermic needle, 1 imp unity ring
 
send to mallmulti Monkey Lord: 1 inkwell, 2 ketchup hound, 1 knob bugle, 8 large box, 1 leathery cat skin, 1 leftovers of indeterminate origin, 4 lihc eye, 2 line, 3 linoleum ore, 2 little paper umbrella, 4 loose teeth
 
send to mallmulti Monkey Lord: 1 lowercase N, 5 magical ice cubes, 1 magilaser blastercannon, 1 many-eyed glasses, 1 mariachi G-string, 8 meat vortex, 1 metallic A, 1 milky potion, 1 miner's helmet, 1 miner's pants, 2 molotov cocktail cocktail
 
send to mallmulti Monkey Lord: 1 mummy wrapping, 1 murky potion, 1 orange peel hat, 3 oversized pizza cutter, 1 pack of KWE trading card, 1 palm frond, 3 papaya, 1 pasta spoon, 1 perforated battle paddle, 4 photoprotoneutron torpedo, 3 plastic guitar
 
send to mallmulti Monkey Lord: 1 pointed stick, 1 powdered organs, 5 pr0n legs, 3 prismatic wad, 1 prosthetic forehead, 1 pygmy blowgun, 1 pygmy pygment, 1 rat appendix, 4 razor-sharp can lid, 3 red pixel, 10 red pixel potion
 
send to mallmulti Monkey Lord: 1 ridiculously huge sword, 1 rocky raccoon, 1 saucepan, 2 scorpion whip, 6 scratch 'n' sniff UPC sticker, 8 scratch 'n' sniff apple sticker, 11 scratch 'n' sniff dragon sticker, 4 scratch 'n' sniff rock band sticker, 4 scratch 'n' sniff unicorn sticker, 3 scratch 'n' sniff wrestler sticker, 1 scrumptious reagent
 
send to mallmulti Monkey Lord: 1 shiny ring, 1 skeleton bone, 1 skeleton key, 5 smart skull, 1 smoky potion, 1 sonar-in-a-biscuit, 1 spider web, 1 spooky hi mein, 2 stalk of asparagus, 1 star, 1 star hat
 
send to mallmulti Monkey Lord: 2 star key lime pie, 1 star staff, 2 stick of dynamite, 1 stolen accordion, 1 sucky decal, 1 super-spiky hair gel, 1 swashbuckling pants, 1 swirly potion, 1 tarrrnish charrrm, 4 tequila grenade, 1 tiny shaker of salt
 
send to mallmulti Monkey Lord: 1 towel, 1 tropical orchid, 1 tropical swill, 4 water pipe bomb, 5 white pixel, 1 wussiness potion, 1 yellow brick road, 5 yeti fur
The message didn't send for some reason.
 
autosell 5 Angry Farmer candy, 1 Mae West with a fly in it, 1 Meleegra™ pills, 1 Mick's IcyVapoHotness Rub, 1 The Big Book of Pirate Insults, 1 awful poetry journal, 10 chaos butterfly, 1 dusty animal skull, 1 enchanted barbell, 2 ennui-flavored potato chips, 1 frilly skirt
 
autosell 1 furry fur, 2 hair spray, 25 handful of confetti, 2 heavy D, 1 jabañero-flavored chewing gum, 1 lime-and-chile-flavored chewing gum, 2 magicalness-in-a-can, 12 meat paste, 2 original G, 2 paranormal ricotta, 1 pickle-flavored chewing gum

autosell 10 plot hole, 2 probability potion, 1 procrastination potion, 2 quasi-ethereal macaroni fragments, 2 radium-flavored potato chips, 2 strongness elixir, 1 tamarind-flavored chewing gum, 5 thin black candle, 3 valuable trinket, 2 wine-soaked bone chips
Total autosale price = 34,400
Autoselling items to NPCs (request 1 of 2)...
You gain 720 Meat
Items sold.
Autoselling items to NPCs (request 2 of 2)...
You gain 33,680 Meat
Items sold.

display 1 Crown of Thrones, 1 Greatest American Pants, 1 Instant Karma, 1 Iron Beta of Industry, 1 Juju Mojo Mask, 1 Spooky Putty sheet, 1 chamoisole, 1 glow-in-the-dark wristwatch, 1 haiku katana, 1 pilgrim shield
Placing items in display case...
This inventory is clean.

EDIT: Would I be able to beg for a mini-script to send the entire contents of my mall multi's inventory back to my main? It would save a lot of time :-)
 
Last edited:
Ah heck. I see there's a bug in the pulverize code. I think it should be pretty obvious and easy to fix though.

Have I stuffed up, or is there a bug in the latest version? I'm not sure why it's trying to send things to my mall multi, as I haven't asked it to do so (and that beautiful new UI doesn't show anything as being amiss).

Take a look at the configuration tab. If you tell it the name of your mall-multi, it will use it. It's as simple as that. (Read the small print under the text box where you entered your mall multi's name.) Should that be changed? It seemed to me that if someone enters a mall-multi, they want to use it.

As for sending it all back to your main. It's only 2 lines, so let's just do that from the CLI.

Code:
ashq import <zlib.ash>; kmail("Banana Lord", "Returned from mall-multi", 0, get_inventory());

Check the name of the character you want to send stuff to. I was just guessing that it was "Banana Lord".
 
Ah! OK. Well, from my point of view it should be changed, or made clearer somehow (just a check-box would be plenty). I automatically filled it in the way I fill in all forms. I assumed it would be retained there until I updated some items to be sent to my mall multi via the standard interface. Yes, you're right, your way of thinking about it makes perfect sense, but the question now is, does it only make perfect sense if you already know what's going on? :P

Thanks!

EDIT: Fun fact: That code you sent me only sends the kmails when I logout. Strange. Works though :D
 
Last edited:
Updated both Inventory Control and relay dB Manager.

I added a check-box to use your mall-multi. If you un-check that, it won't use your multi, even if you put in a name.

I also fixed the pulverize function to deal with the bug that stopped your pulverization. Also, now it will recognize sewer wads, floaty pebbles and floaty gravel as items you want to send to wadbot if you don't have access to the malus.

And the relay dB Manager will now list the quantity of items that you possess in places where that info might be useful.

EDIT: Fun fact: That code you sent me only sends the kmails when I logout. Strange. Works though :D
I doubt that. Mafia just doesn't recognize incoming kMails all the time when your chat window is closed.
 
Last edited:
Bale, this is beautiful! I can't wait to start using it!

Currently I use my own inventory cleanup scripts and they require me to keep a spreadsheet of all the items and what I want to do with them. This new relay OCD script is going to save me a lot of time going back and forth between my spreadsheets and my scripts.

I have an idea for your script, just wondering if you think it makes sense to add it. I love having OCD control over my inventory, but i'm also a packrat, so what I do is mallsell, autosell, display, smash all my items, then I closet everything I want to keep, but don't want in my inventory. I'm thinking just a checkbox next to each item that says closet, that will do what you have it categorized as (including keep) and then put the rest in the closet. This allows people like me to keep everything I think I might need some day, but not have to put it in a displaycase or sort through it on the inventory screen.
 
That may sound like a small thing to you, but it is really a major deal. I don't foresee adding a feature like that soon. It's a bit tough for me to get motivated about a difficult feature that I'd never use. Perhaps I'll get to it someday.
 
Fantastic!

Oh and my chat window was open. And I double checked my messages on my main and my multi before logging out (my multi). Immediately after doing that the kmails appeared on my main's chat window. It doesn't matter, it's just seems strange :-)
 
I'm getting a problem with the pulverize function, seems to be doing the same as Banana Lord reported although I did notice the reply saying it was fixed. I'm using v3.12.

Code:
pulverize 16 bat-ass leather jacket, 18 giant needle
Unable to invoke 16
This inventory is clean.
 
Make sure you don't have any aliases that can interfere. I know that sort of error have happened to me in that case...
 
Back
Top