View Full Version : Pre-Ascension Buying Script
theletterkay
08-08-2011, 04:28 PM
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
08-08-2011, 04:45 PM
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 (http://wiki.kolmafia.us/index.php?title=CLI_Reference) for which it is likely to do and how that interacts with preferences.
theletterkay
08-08-2011, 04:50 PM
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.
fronobulax
08-08-2011, 05:49 PM
acquire does work the way Ii said it does, but I see you corrected your error.
retrieve_item (http://wiki.kolmafia.us/index.php?title=Retrieve_item) is the ash equivalent.
Veracity
08-08-2011, 06:16 PM
Nevermind. Aquire does behave like that now. It didnt use to. I just hadnt tried recently.
Looking at Revision 5729 (http://kolmafia.svn.sourceforge.net/viewvc/kolmafia/src/net/sourceforge/kolmafia/session/InventoryManager.java?revision=5729&view=markup) 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".
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 (http://kolmafia.us/showthread.php?1818-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
08-09-2011, 02:40 AM
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?1529-ascensionChecklist.ash-Make-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.
belladawna
08-09-2011, 11:45 AM
http://alliancefromhell.com/scripts/mafia/scripts/Stocking.txt
Sometimes simple works best.
lostcalpolydude
08-09-2011, 12:32 PM
http://alliancefromhell.com/scripts/mafia/scripts/Stocking.txt
Sometimes simple works best.
That script is way out of date probably (though it's not a bad starting point). I'm too lazy to update it since my version will leave stuff in storage if that's where it currently is.
Powered by vBulletin® Version 4.2.0 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.