OCD Inventory control

Bale

Minion
I was wondering how can I change the script so that it will not sell items that are not in the list.

Where it says foreach it in $items[] you'd want to foreach ocd instead. There are a few other places where you'd want to change things also, but they all follow naturally from that first change.
 

Tarko

Member
Am sorry to ask that, but I really dont trust myself with something that could make my inventory go away for ever...

Would anyone mind hinting me toward the right direction with Zarcon's historical_price() == max(2*autosell_price(),100) ?

I know it would go in there somewhere:
case "mall":

if(item_amount(it) <= ocd[it].q)

break;

if(mall_q != 0)

mall[mall_line]= mall[mall_line] + ", ";

if(historical_age(it) > 2) price = historical_price(it);

else price = mall_price(it);

mall_total = price * (item_amount(it)-ocd[it].q) + mall_total;

mall[mall_line]= mall[mall_line] + to_string(item_amount(it)-ocd[it].q)+ " "+to_string(it)+ " @ "+to_string(price);

mall_q = mall_q + 1;

if(mall_q == 11) {

mall_line = mall_line +1;

mall_q = 0;

}

break;

But Im not too sure where or how.

My guess is something like:
if(historical_age(it) > 2) price = historical_price(it) && historical_price(it) == !max(2*autosell_price(),100)
else auto[it]
;

or something along those lines... See why I ask?
Any help would be appreciated.
 
Last edited:

Bale

Minion
Well, you only want items that are NOT specifically slated to be autosold, pulverized or malled to be tested like that right? (Please correct me if I'm wrong.) If you want anything outside of your lists to be autosold instead of malled under that criteria, then you're looking in the wrong section.

lines 195-207:
Code:
			} else {
				if(historical_age(it) > 2) price = historical_price(it);
					else price = mall_price(it);
				if(mall_q != 0)
					mall[mall_line]= mall[mall_line] + ", ";
				mall_total = price * item_amount(it) + mall_total;
				mall[mall_line]= mall[mall_line] + to_string(item_amount(it))+ " "+to_string(it)+ " @ "+to_string(price);
				mall_q = mall_q + 1;
				if(mall_q == 11) {
					mall_line = mall_line +1;
					mall_q = 0;
				}
			}
Change to:

Code:
			} else {
				if(historical_age(it) > 2) price = historical_price(it);
					else price = mall_price(it);
				if(historical_price(it) == max(2* autosell_price(),100)) {
					if(auto_q != 0)
						auto[auto_line]= auto[auto_line] + ", ";
					auto_total = autosell_price(it) * (item_amount(it)-ocd[it].q) + auto_total;
					auto[auto_line]= auto[auto_line] + to_string(item_amount(it)-ocd[it].q)+ " "+to_string(it);
					auto_q = auto_q + 1;
					if(auto_q == 11) {
						auto_line = auto_line +1;
						auto_q = 0;
					}
				} else {
					if(mall_q != 0)
						mall[mall_line]= mall[mall_line] + ", ";
					mall_total = price * item_amount(it) + mall_total;
					mall[mall_line]= mall[mall_line] + to_string(item_amount(it))+ " "+to_string(it)+ " @ "+to_string(price);
					mall_q = mall_q + 1;
					if(mall_q == 11) {
						mall_line = mall_line +1;
						mall_q = 0;
					}
				}
			}

Since max() is not a function of ash, you'd need to define it by including zlib, or adding the function to this script:

Code:
int max(int a, int b) {
   if (a > b) return a;
   return b;
}

I haven't actually tested any of that, but it looks good to me. Note that everything that isn't marked to be saved, will either be mallsold or autosold.
 

Tarko

Member
Brilliant! it's working marvelously!

2 little point I'd like to point out:

1- Data creator crashed when it encountered jabañero-flavored chewing gum
2- In your fix above you forgot the second 'it' in:
Code:
if(historical_price(it) == max(2* autosell_price([B]it[/B]),100)) {

Appart from that (which a 5sec fix as fixed) it's perfect!

Any gifts you would like?
 

Bale

Minion
Thanks for fixing my typo.

For the data creator, try inputting that as jabañero-flavored chewing gum or even just jaba chewing gum would do the job. (The second one works because of kolMafia's fuzzy matcher.)

As for gifts... Well, I am a collector of stuffed Hodgmen. (See my signature!) So if you have or could acquire a stuffed Hodgman I'd be grateful for it. However if that's a bit too much trouble/expense, then I quite understand.
 
Last edited:

seamer

New member
I'm starting to get an itch for collecting as many outfits as I can...Does OCD account for that or is it a case of modifying ocd data.txt?
 

Bale

Minion
It's all about modifying OCD Data. That holds the list of what you keep. The only assumption the script makes is that it wants to mall everything that isn't in that file.
 

Rahmuss

Member
You know how you can sell items in your inventory and just check the box on all items you want to sell? Is there a way to do the same thing, only instead of selling them from inventory, send them to your mall store? I don't care about pricing or anything, the default 9999999 is fine. I just hate the 11 item limit and was wondering if there was a way to mass send all desired items to the mall store. Even if you have a checklist that creates a data file and then after the file is created (gone through all the items) then it will send them (11 at a time) to the mall store. Any thoughts? Does something like this already exist?
 

Bale

Minion
KolMafia can do that straight out of the box. In the item manager highlight everything you want to mall, then on the right side click the button that says "place in mall".
 

Banana Lord

Member
As of one of the more recent builds (I'm not sure exactly which one sorry) the script will no longer equip my gear once it's finished running. Not a huge problem as I can fix it with a single CLI command stuck at the end of the script, but I thought you might like to know if you don't already.

As a sidenote, when the script was re-equipping everything properly it was doing so one piece at a time, rather than as a whole outfit, which could be acheived via the existing backup outfit or "your previous outfit" could it not?
 

Bale

Minion
You're using an old version of this script. I switched over from checkpoint to using the backup outfit some time ago. I suspect that the other problem you report will be taken care of also.
 

Bale

Minion
Updated my script. Only notable change is that it alphabetizes the list of items to be malled and autosold.
 

dindon

New member
I just have to say, this script is awesome, and exactly what I needed. I had gotten to the point where I dreaded opening my inventory because it was so huge. After 2 runs of the script (the first one ended in an OOM error - an indicator of the enormity of my stockpile of junk?) and 12 hours, my inventory was tiny, I had made about 5 mil (off of junk - almost nothing in there was worth more than 20k), and I had discovered an IoTM I didn't even know I had. So thank you.

(I feel like someone in one of those "gold for cash" commercials. "I made 10,000 dollars selling my old and broken jewelery! Thanks gold4cash!!" *fans out bills*)
 

halfvoid

Member
Feature request: An input script that searches my inventory for items not already listed in OCD Data Creator.ash and exports them to a .txt file in the $item() format.

Or is there a simple way to export ALL of my items into a .txt file like that and just dump that into the top of OCD Data Creator?
 

Banana Lord

Member
You might be able to get mafia to output a list of all the items in your inventory, but I'll let one of the experts comment on that. When you say "dump into the top", just make sure you include the save [$item[ prefix and the ]] = -1; prefix for each. A speedier way of doing this than copy/pasting is a program like Text Wrangler (Notepad probably can too, but I don't know) which can add a given prefix and suffix to selected lines at a click.

EDIT: The get_inventory() command looks like your friend here. I'm not sure how to supress the integer associated with each item, or even if you can. But either way, typing "ash get_inventory()" without the quotes'll get you a map of your inventory which you can copy/paste from mafia's gCLI into an appropriate editor.
 
Last edited:

halfvoid

Member
get_inventory() gives me the item list, but i was looking for the $item format they are displayed in the Data Creator.
looks like my best option so far though.
i've been trying to weigh whether i want to use this or Mr.Edge's HC inventory control.
 

Banana Lord

Member
I don't believe there is a way to have them outputted pre-prefixed, but I could be wrong. The way I add items to OCD is just as I said above (if en-masse, otherwise I just copy/paste).
 
Top