First things first: Kolmafia has breathed new life in to my playing (dormant since 2005). Holatuwol, you're a miracle worker. Wow!
I'm joking about the function name, but I'd love a way in ASH to duplicate the functionality of acquire/retrieve() but with a maximum cost. Here's how I imagine it'd work.
int retrieve_item(int quantity, item it, int budget);
This function would calculate the total cost to retrieve the number of items specified by standard mechanisms: mall, chez snootee, Hangks if available, etc. If the cost is less than budget, it would execute the retrieves. If the cost is more than budget, it would return the price difference. If the items are unavailable, it returns zero.
A sister function would be budget_item. It would do the same thing, except not buy.
Perhaps one more thing: retrieve would be extended to return what it actually paid for the item, in case you're shopping on a limited budget and want to keep track of how much you spend.
This would be a HUGE boon to a whole class of scripts. Want to have twinkly wads at breakfast, but worried the price will spike sometime and kolmafia will auto-bankrupt you? No problem. Acquire only if the total price is less than 4500 meat, otherwise, throw an error so you know you need to change breakfasts.
Or think about scripts like maximize.ash. You could write a script that would maximize your +HP, given everything you own plus a budget of 100,000 meat. It could recommend or purchase specific purchases and even execute them for you.
Or wossname.ash could let you specify a budget for meat vortices and related handy items... there's tons of uses!
The one problem I can anticipate is that mall prices can change fast. Say you're looking for 2 hell ramens for 5,000. And say there appear to be 1 for 2,450 and 1 for 2,550. It purchases the first one, and the second disappears, so it's not able to complete on budget. Suck. Perhaps it has more robust error cases for "got some but not all"?
Anyway, I can imagine this enabling a whole new class of scripting awesomeness. It's top on my wishlist for kolmafia.
Keep up the great work, H!
I'm joking about the function name, but I'd love a way in ASH to duplicate the functionality of acquire/retrieve() but with a maximum cost. Here's how I imagine it'd work.
int retrieve_item(int quantity, item it, int budget);
This function would calculate the total cost to retrieve the number of items specified by standard mechanisms: mall, chez snootee, Hangks if available, etc. If the cost is less than budget, it would execute the retrieves. If the cost is more than budget, it would return the price difference. If the items are unavailable, it returns zero.
A sister function would be budget_item. It would do the same thing, except not buy.
Perhaps one more thing: retrieve would be extended to return what it actually paid for the item, in case you're shopping on a limited budget and want to keep track of how much you spend.
This would be a HUGE boon to a whole class of scripts. Want to have twinkly wads at breakfast, but worried the price will spike sometime and kolmafia will auto-bankrupt you? No problem. Acquire only if the total price is less than 4500 meat, otherwise, throw an error so you know you need to change breakfasts.
Or think about scripts like maximize.ash. You could write a script that would maximize your +HP, given everything you own plus a budget of 100,000 meat. It could recommend or purchase specific purchases and even execute them for you.
Or wossname.ash could let you specify a budget for meat vortices and related handy items... there's tons of uses!
The one problem I can anticipate is that mall prices can change fast. Say you're looking for 2 hell ramens for 5,000. And say there appear to be 1 for 2,450 and 1 for 2,550. It purchases the first one, and the second disappears, so it's not able to complete on budget. Suck. Perhaps it has more robust error cases for "got some but not all"?
Anyway, I can imagine this enabling a whole new class of scripting awesomeness. It's top on my wishlist for kolmafia.
Keep up the great work, H!