Pre-Ascension Buying Script

theletterkay

New member
I'm looking to make a preascension buying script. I want it to check my inventory and if i have less than a certain number of an item, buy a certain number.

Example: (What I need)
3 Star Keylime pies
1 Pebblebrau
2 Pumpkin bombs
1 tropical ochid

I want it to check if i have any of the item, then buy up to the amount i want. IE: I have 1 star key lime pie, I want it to know to buy 2 more instead of just saying buy 3.

(No, this is not the complete list of items that I need, I can write it all myself. I just dont know how to state that in a form of a script that mafia can read.)
 

fronobulax

Developer
Staff member
if you are not using ASH but just a CLI script then you probably want acquire as in

acquire 3 star key lime pie
acquire 1 pebblebrau
acquire 2 pumpkin bomb

and so on. acquire will make/buy/unstash or pull until you have the requested number of items. See this for which it is likely to do and how that interacts with preferences.
 

theletterkay

New member
I would very much prefer it to be a ASH file.

And that doesnt really solve what I want, because even if I have 3 Star pies in my inventory already, aquire wont check that, it will just aquire 3 more. I just need 3 on my name.

But I havent seen anything anywhere saying that something like this is even possible, so it may not be. I just thought I would check here before going off and just using aquire or buy script.

====Edit======

Nevermind. Aquire does behave like that now. It didnt use to. I just hadnt tried recently.
 
Last edited:

Veracity

Developer
Staff member
Nevermind. Aquire does behave like that now. It didnt use to. I just hadnt tried recently.
Looking at Revision 5729 of InventoryManager.java, dated February 13, 2008 - 3 1/2 years ago - I see that retrieveItem (the workhorse of "acquire") took the amount of the item you already had into account when deciding how many new items it needed to get.

I'm fairly certain that it behaved that way before then, too, but I can't easily check, since I don't remember what file it used to be in; that was the revision that created InventoryManager.java.

So, if you hadn't tried "recently", that would have to mean "within the last 3 1/2 years, at least".
 

Bale

Minion
I'm looking to make a preascension buying script. I want it to check my inventory and if i have less than a certain number of an item, buy a certain number.

This does much more than you are asking for, but you want, you can use the stocking manager section of OCD Inventory Control. It is quite possible to use only that portion of what this script can accomplish.

Sadly the script does so much (and is so complicated as a result) that I cannot recommend it as a good example of how to write a simple stocking script.
 

Ethelred

Member
I'm looking to make a preascension buying script. I want it to check my inventory and if i have less than a certain number of an item, buy a certain number.

Example: (What I need)
3 Star Keylime pies
1 Pebblebrau
2 Pumpkin bombs
1 tropical ochid

I want it to check if i have any of the item, then buy up to the amount i want. IE: I have 1 star key lime pie, I want it to know to buy 2 more instead of just saying buy 3.

(No, this is not the complete list of items that I need, I can write it all myself. I just dont know how to state that in a form of a script that mafia can read.)

You might want to look at this script: http://kolmafia.us/showthread.php?1...ke-sure-you-have-the-items-for-a-painless-run I customized it for myself to be more just a checker script than a stocker script, but that option is available.
 
Last edited:
Top