Feature - Rejected Purchasing from NPCs only

Veracity

Developer
Staff member
I continue to wait for an explanation of why we should do anything to accommodate scripts that insist on using "buy" (which will use the mall or NPC stores, whichever is cheaper, and leave items in inventory or storage, depending on what kind of store you purchased from and whether you were in Ronin or not) rather than "acquire" (which will obey mall and NPC purchasing settings and is guaranteed to leave the item in inventory, if it succeeds.)

Unless you can explain why you HAVE to use "buy" rather than "acquire", don't bother responding to this thread. I've asked that question at least three times, and, so far, it has been ducked. I'm not interested in any more hand-waving bullshit. Justify your desire to not use the mechanism that KoLmafia provides which will behave the way you want it to behave.
 

Veracity

Developer
Staff member
With the "improvement" to KoL that allows purchases to be made from the mall in Ronin I want a way to disable such purchases unless I explicitly enable them
KoL changed.
Therefore, users of KoL have to modify their behavior to accommodate the new behavior.

Previously, if you were in Hardcore or Ronin, if you tried to purchase from the Mall, KoL said "Nuh uh!"
Previously, if you were in Hardcore or Ronin, if you asked KoLmafia to purchase from the Mall, KoLmafia said "nuh uh!" and didn't bother submitting a request to KoL.

KoL changed and now, if you are in Hardcore or Ronin, you CAN purchase from the Mall - and the Meat comes from storage and the item goes into storage,
In response to the KoL change, if you are in Hardcore or Ronin, KoLmafia knows that you CAN purchase from the Mall - and the Meat comes from storage and the item goes into storage.

Is this a change from old user expectations? It is! And it exactly mirrors the change from user expectations that KoL itself made.

A user of KoL who does not use KoLmafia HAS to be aware that Things Have Changed and if they go to the mall, they will spend Meat from storage, and the item they purchase will not land in inventory.

A use of KoLmafia HAS to be aware that Things Have Changed - in KoLmafia, mirroring the Things That Changed in KoL itself - and if they go to the mall, they will spend Meat from storage, and the item they purchase will not land in inventory.

I just can't bring myself to believe that if KoL changes and KoLmafia changes to agree with the underlying game, that it is problem if KoLmafia doesn't, somehow, hide the KoL change from the user and go through contortions (new preferences and such) to pretend that KoL did not change and things are just the same as they were before.

If KoL changes, KoL users have to change their behavior to accommodate the changes, and if KoLmafia tracks those changes, then KoLmafia users have to change their behavior to accommodate the changes.

I just can't comprehend why somebody would argue to the contrary.

KoL changed. KoLmafia changed to agree with KoL changes. You need to change your expectations/behavior to agree with KoL's - and KoLmafia's - changes.

Deal with it.
 
Last edited:

Darzil

Developer
I raised the suggestion of mafia acquiring the antique accordion in that thread, but automatic toy accordion acquisition was left as the only in-run acquisition. As such, it was left to scripts to acquire the actually useful level of accordion...

You raised the idea of mafia AUTOMATICALLY acquiring the antique accordion if you tried to cast a buff when you had over 5k meat. Usually on day one of an ascension when I have over 5k meat it's because I'm saving for a Mushroom patch or planning to eat Hi Meins, and I really don't want to spend that level of money without reason.

Before the change to the sewer, when you cast a buff, Mafia used to try to automatically acquire a 5 turn buff accordion (or so it looked in the code), after it Mafia would try and would fail. Out of Ronin/Hardcore it'd acquire a 10 turn buff accordion instead.

Now that code makes Mafia try to automatically acquire a 5 turn buff accordion. Out of Ronin/Hardcore it'd acquire a 10 turn buff accordion instead. This was as close as I could get to functionality existing for years.

Given the protests in the G-D forums about the cost of the accordion, and fairly constant moans in /hardcore (which will decrease over time), I don't think we should enforce that spending on users. My view is that it is situational. Sometimes, especially on day one, getting MP is harder than getting meat, sometimes it's the other way around. In HC KOLHS for example, if I'm going for speed, I'll be using 10 turns of Inigos (2 Hi Mein) of crafting on day one, and casting enough turns of Ode for drinking a 2 drunk booze every now and then. For that you are looking at whether to spend 2.5k (plus cost of Meatcar) when meat is tight (5k for the two Hi Meins + Oven), to save 100 MP.

I don't understand why you think you have to use buy, though, to enforce your view of how it should work. Acquire doesn't make Mafia use it's (my) view of which accordion it wants, it just respects Ronin/Hardcore and Spending limits. Mafia chooses to use acquire to get one, rather than buy, you don't request and accordion and get given the one Mafia chooses.
 

slyz

Developer
Leaving the the buy() versus retrieve_item() question aside, would it make sense to separate buy() into npc_buy() and mall_buy()?

The buy CLI command would recognize "buy mall" and "buy npc", and limit Mafia's purchase options. We would leave buy() with its current behavior (calling the buy CLI command), and npc_buy() or mall_buy() would use the correct flag.

This would leave users and scripters with:

- acquire: Mafia automatically decides how to obtain the item (respecting autoBuyPriceLimit), even if it ends up in Hagnks.
- buy: Mafia purchase the cheapest available item, whether from an NPC or from the mall, even if it ends up in Hagnks.
- buy npc: Mafia purchases from npc players only, item never ends up in Hagnks.
- buy mall: Mafia purchase from the mall only, even if it ends up in Hagnks.

I think that gives a good enough range of options.
 

Veracity

Developer
Staff member
- acquire: Mafia automatically decides how to obtain the item (respecting autoBuyPriceLimit), even if it ends up in Hagnks.
That is a change in behavior. "acquire" is defined to get the object as cheaply as possible into inventory. No way.

- buy: Mafia purchase the cheapest available item, whether from an NPC or from the mall, even if it ends up in Hagnks.
Current behavior.

- buy npc: Mafia purchases from npc players only, item never ends up in Hagnks.
Like acquire, except if you are out of Ronin, this will force you to buy from the npc, even if it is cheaper from a mall store. Why would you want to do that?

- buy mall: Mafia purchase from the mall only, even if it ends up in Hagnks.
Like buy, but this will force you buy from the mall, even if it is cheaper from an npc. Why would you want to do that?

I think that gives a good enough range of options.
Except that the two we have already cover all the sensible cases and the two we don't have are for people who want to spend more Meat than is necessary. Why should we cater to stupidity?
 

slyz

Developer
I didn't want to change how acquire works, I just forgot how it works :)
My previous post should read:

- acquire: Mafia automatically decides how to obtain the item (respecting autoBuyPriceLimit and various other user settings), item never ends up in Hagnks.

Like buy, but this will force you buy from the mall, even if it is cheaper from an npc. Why would you want to do that?
It was only to satisfy my sense of symmetry, "buy mall" isn't needed.

I still like the option to "buy npc", so scripts can avoid any ambiguity over where the purchased item will end up for players in HC/Ronin while still getting the benefits of "buy".
 

roippi

Developer
I believe "acquire" will prefer NPC shops when available rather than comparing NPC and mall and deciding which is cheaper. I recall an old bug report to that end. I also don't necessarily think this is wrong behavior.

As for buy_npc: meh. If you are specifically looking to limit your vulnerability to spending too much money, why aren't you using acquire?
 

fronobulax

Developer
Staff member
As for buy_npc: meh. If you are specifically looking to limit your vulnerability to spending too much money, why aren't you using acquire?

I don't see buy_npc as being helpful or necessary either. Since I answer rhetorical questions the reason for not using retrieve_item or acquire is that the differences in behavior seemed to be insignificant until the KoL behavior changed. As noted upstream I certainly intend to root out uses of buy in my own scripts and encourage others to do the same.

Towards that end I fantasize about a KoLmafia change that prints a message to the gCLI to the effect that "Script <name> called the two parameter version of buy at line <line number>" but I don't think it would end well if I just unilaterally made the change :) KoL is changing too fast to use a local change when I don't always have a build machine available.
 

slyz

Developer
That behavior sacrifices negligible quantities of meat and saves server hits, so it's a good one :)

It looks like the "buy versus acquire" debate can't be put aside. Apparently the answer is "you shouldn't use buy()", but I don't think we actually want to enforce that.

What bothers me is that scripts that use buy() when the player is in HC/Ronin don't know if the item will end up in the player's inventory.
 

Veracity

Developer
Staff member
What bothers me is that scripts that use buy() when the player is in HC/Ronin don't know if the item will end up in the player's inventory.
The script knows that the player is in HC/Ronin. Having that knowledge, if the script wants an item which is available from an NPC store and it is important for the item to end up in inventory, it will use retrieve_item(). If the item is available from NPCs but it is not important if it ends up in inventory, just that it be obtained as cheaply as possible, it will use buy().

If the script is coded to use buy() while in HC/Ronin, then yes - it can't know for sure where the item will end up.

Why does that bother you?

It looks like the "buy versus acquire" debate can't be put aside.
I am still waiting for the OP (or anybody) to explain why he wants to use "buy" while in HC/Ronin rather than "acquire" to get an item which he wants in inventory. I've asked that repeatedly. The response, so far, is crickets.
 

lostcalpolydude

Developer
Staff member
I think the reasoning is that it used to be easy to ignore a user's preference to not use NPCs, and now it isn't. I don't think that's a reason for mafia to change though.
 

Veracity

Developer
Staff member
Code:
boolean buy_npc( int count, item it )
{
    boolean old = get_property( "autoSatisfyWithNPCs" ).to_boolean();
    try {
	if ( !old )
	    set_property( "autoSatisfyWithNPCs", "true" );
	return retrieve_item( count + item_amount( it ), it );
    } finally {
	if ( !old )
	    set_property( "autoSatisfyWithNPCs", "false" );
    }
}
Whatever. It's not rocket surgery.
 

Bale

Minion
I agree with Veracity on nearly everything she posted in this thread. My one point of contention is that I cannot understand why mafia should refuse to purchase from NPCs. I understand why the player might want to resist purchasing from the mall since it can easily get pricier than the player would like, but NPCs are like air. Can anyone explain why NPC purchasing would be bad for someone?

I'd favor removing the preference to not purchase from NPCs. That would make the buy_npc() script she just posted quite unnecessary.
 

lostcalpolydude

Developer
Staff member
Some people want "make 20 plain pizza" to make 5 with on-hand ingredients and then stop rather than spend any meat to get more ingredients. There's probably a better example with a more realistic recipe. It's true that the implied acquire there is different from an explicit one, but decoupling that would be a bit of work at least.
 

Veracity

Developer
Staff member
I believe "acquire" will prefer NPC shops when available rather than comparing NPC and mall and deciding which is cheaper. I recall an old bug report to that end. I also don't necessarily think this is wrong behavior.
I think that is probably correct. The underlying function - InventoryManager.retrieveItem - is complicated. If it decides that it needs to do a mall search (because you are out of Ronin), the list of results will include player stores and NPC stores, and it will pick the cheapest. But I think there is a check for "is this available from NPC stores" before it decides to do that.

Considering that there are some items which are cheaper from player stores than from NPC stores - because the autosell price is less than half of the NPC store price - that's not always Meat-optimal, but it does save the mall search, and if you are out of Ronin, the assumption is that Meat is not a big problem for you.
 

Fluxxdog

Active member
I am still waiting for the OP (or anybody) to explain why he wants to use "buy" while in HC/Ronin rather than "acquire" to get an item which he wants in inventory. I've asked that repeatedly. The response, so far, is crickets.
Actually, I think I can answer that. You want the antique accordion. How are you going to get it? You're going to buy it. It's more intuitive to buy something than it is to acquire it when you're planning on spending meat.

Perhaps it's not acquire that needs to be changed, but buy itself could use one. Just a safety catch, like eating without milk. In Ronin/HC, it asks you once a day if you want to use the command as is. If yes, buy away. If not, acquire/retrieve_item() away.

In KoL, it's easy to avoid the mall because you have to actually GO TO THE MALL so you already know the rules. The buy command and function in mafia aren't as obvious unless you're someone who codes and develops for it. I didn't realize the problem existed in my old scripts until this thread came up.
 
Top