Bug - Waiting for Info Mafia attempting to craft and purchase items already available, when changing outfits

chown

Member
First off, let me acknowledge that this is going to be a somewhat poor bug report, because I was in a hurry when it happened and I didn't note the exact sequence of events that happened, at the time that they happened. However, earlier today I spent 500 Freddies on an item that I didn't want, due to this issue. That stung a bit, and I'm just hoping to perhaps save folks from potentially even worse consequences. So I apologize in advance.

Earlier today, I was running Mafia, and had done "maximize mp regen" in the CLI. This worked fine at the time, and it equipped my fudgecycle, as well as some other items that I had in my inventory. Later (after trick-or-treating, and probably some other actions in-game that I have subsequently forgotten) I performed some innocuous-seeming command like (I don't remember if this is exactly it) "equip crown of thrones". At that time, Mafia proceeded to try to obtain all (well, most?) of the previously-equipped items. It had issued a couple of "are you sure you want to spend adventures crafting" warnings -- to which I responded "no!", and mashed on my "Esc" key. And at that point I discovered that it had used my fudge wand to convert some fudgecules into a second fudgecycle. Which was annoying, but not that big of a deal.

"Oh well," I thought. Mafia had somehow lost track of the fact that I already had it. So, I tried clicking the "refresh" button in the main GUI. (I think I have done this in order to resolve some similar sorts of issues in the past.) Then I did some other stuff. And then I went to the Dreadsylvania Inn, in order to exchange some Freddy Kruegerrands for a dreadful fedora. And I thought that I should check my inventory, just to make sure that I hadn't purchased one already and then forgotten about it. So I typed "inv dread" in the CLI. And, I didn't see my already-purchased dreadful sweater. I thought "oh dear, it's confused again" (although in retrospect I suspect that perhaps my earlier attempt to un-confuse it had failed to do so). I saw that the items pane also lacked the "dreadful sweater" that I was certain I had already purchased. I then looked at the equipment pane. And there, I noticed that the "shirt" drop-down did still list the dreadful sweater. Which is clearly not consistent with the information from the other pane, and the "inv dread" command I had just typed. I clicked on the "dreadful sweater" in the equipment manager, (and I guess I must have clicked the "equip" button, too). Mafia traded my Freddies for a second sweater, which it then equipped.

Anyway, this all happened with a recent (less than 24-hour old) Mafia SVN build. There may have been an exception that had been reported, earlier, to the console where Mafia was running. I often get ones that report some index-out-of-bounds-looking thing on panes in the GUI. They have generally seemed harmless in the past, so I have gotten trained to just ignore them. Also, I have been using Bale's BatMan relay enhancement, which has (as of about 24 hours ago) stopped working for me.

Hope this helps!

View attachment DEBUG_20131029.txtView attachment chown_20131029.txt

The fudgecycle purchased happened around turn 69942. The sweater one was around 69952.
 
Last edited:

Veracity

Developer
Staff member
1) Please post/attach your session log for the day.
2) If there were exceptions, I would expect to see stack traces in a DEBUG log. See if you have one and, if so, attach it too.
 

Theraze

Active member
Bale updates CHIT. BatMan is made by zarqon... which of those were you actually using? CHIT might be related, since it messes with the character pane, but BatMan as a fight override shouldn't be affecting those things...
 

chown

Member
Whoops, yeah. I meant zarqon's BatMan_RE. I figured I should mention it, because it stopped working just recently.
 

fronobulax

Developer
Staff member
Perhaps related or perhaps irrelevant. You decide :)

Several weeks ago, I got around to doing The Sea. I had an outfit that included sea chaps. At some point there were no sea chaps in my inventory. When I went to change into the outfit, instead of informing me I had none, it got them. I can't recall whether it made them or bought them but it definitely used resources to obtain them rather than tell me it was unable to equip the outfit.

Since I have no idea whether this is a feature I missed discussion about or side effect of some other change I had not taken the effort to research it to the point of making a report.
 

Theraze

Active member
Guessing that both of you have the auto-coinmasters enabled, which would acquiring it, if you tell it to, not a bug.

As to why the OP inventory got confused... that would be the buggy question. :) As long as auto-satisfy-coinmasters was on.
 

lostcalpolydude

Developer
Staff member
Since I have no idea whether this is a feature I missed discussion about

It (acquiring equipment in outfits to equip them) was added so that mafia would remove items from the closet if you closet them to protect them from pvp. I don't closet equipment that I use, so I don't get that benefit. The experience you and others have described sounds like something I wouldn't like, but I never use custom outfits so I won't ever run into it.
 

Veracity

Developer
Staff member
I recently ran into a way to make KoLmafia lose track of a piece of equipment. If I recall, I did this:

- equipment piece is in inventory
- I don't have the necessary stat to equip it.
- it does not show up in the Gear Changer dropdown for the appropriate slot.
- in the CLI, I said "equip xxx"
- that failed, since I didn't have the requisite stat.
--> The equipment showed in the Gear Changer in the slot as if it were equipped.
--> The equipment was no longer in inventory since it was, supposedly equipped
- I hit the "refresh" button, which called api.php and refreshed the equipment in the Gear Changer
--> The equipment was still not in inventory.
- I refreshed inventory and it was back.

So, yes - "fails to equip" are not always recognized. That is a bug. The OP in this thread said he "I tried clicking the "refresh" button in the main GUI" - which is an api.php refresh, NOT an inventory refresh.

As I requested up thread, the OP needs to post his session log for the day. That will have every attempted "equip" command in it. And hopefully, I'll be able to see exactly how we lost track of this or that possession.

Until and unless he does so, there is nothing we can do to diagnose his specific problem.
 

chown

Member
Logs are added to the first post. Unfortunately, I don't see commands to equip stuff around the relevant places. Er, and now that I look at it, the DEBUG one isn't from before the problem happened. (It's one of only two DEBUG_* files in the directory from which I run Mafia. The other is more than a week old.) Anyway, I guess I was actually doing stuff via the modifier maximizer. Perhaps you can glean some earlier issue, though, that might have confused Mafia.

Oh, and unsurprisingly I do have the "obtain items from coinmasters" option turned on. It's useful when it isn't firing unexpectedly.

Good luck, and let me know if there's anything else I can provide!
 

Veracity

Developer
Staff member
I can certainly see bogus behavior in the session log. My sympathy.

equip acc3 fudgecycle

mall.php?category=allitems&consumable_byme=0&weaponattribute=3&wearable_byme=0&nolimits=0&max_price=0&sortresultsby=price&justitems=0&x_cheapest=10&pudnuggler=%22fudgecycle%22

Visiting Fudge Wand

trading 2500 fudgecules for 1 fudgecycle
Encounter: fudgecycle
You acquire an item: fudgecycle

equip acc3 fudgecycle
I wish we logged "maximize" commands to the session log.

I guess I'm going to have to look at that command. I never use it, myself; I open up the Maximizer frame, tell it to maximize for such-and-such, and then look at what it recommends for me. Usually, I'll say "equip everything recommended". For something that is already equipped that is appropriate, it doesn't want to remove it.
 

Veracity

Developer
Staff member
OK, look at this.
choice.php?forceoption=0

[69821] The Primordial Soup
Encounter: Soup For You
Took choice 346/1: unknown
choice.php?pwd&whichchoice=346&option=1
You gain 10 Muscleboundness

equip hat sponge helmet

equip weapon Uncle Hobo's highest bough

equip off-hand Bag o' Tricks

equip back paperclip cape

equip shirt dreadful sweater

equip pants square sponge pants

equip acc1 hardened slime belt

equip acc2 velcro boots

equip acc3 fudgecycle
choice.php?forceoption=0

[69822] The Primordial Soup
Encounter: Yes, Soup For You...
Took choice 347/1: unknown
choice.php?pwd&whichchoice=347&option=1
You gain 10 Mysteriousness

You did a choice adventure in the Ancestral Memories, maximized for MP regen, and did another choice adventure.

Later:

[69941] Trick-or-Treating
Encounter: Trick or Treat!
Took choice 804/2: unknown
choice.php?whichchoice=804&pwd&option=2

clan_hobopolis.php?place=2
clan_hobopolis.php?place=3&action=talkrichard&whichtalk=3

equip hat sponge helmet

equip weapon Uncle Hobo's highest bough

equip off-hand Bag o' Tricks

equip back paperclip cape
choice.php?forceoption=0

equip shirt dreadful sweater

[69941] Dreadsylvanian Woods
Encounter: The Cabin in the Dreadsylvanian Woods

equip pants square sponge pants

equip acc1 hardened slime belt

equip acc2 velcro boots

equip acc3 fudgecycle

equip familiar little box of fireworks
Took choice 721/2: Freddies, Bored Stiff (+100 spooky damage), replica key (0) -> Dreadsylvanian auditor's badge, wax banana (0) -> complicated lock impression
choice.php?pwd&whichchoice=721&option=2
Encounter: What Lies Beneath (the Cabin)
Took choice 723/1: Freddies
choice.php?pwd&whichchoice=723&option=1
You acquire Freddy Krueggerand (6)
choice.php?forceoption=0
You stopped trick-or-treating, maximized for MP regen - and then in the middle of the equipment swapping, you went to a Dreadsylvania choice adventure. The maximizer continued trying to swap equipment, but since you were in the middle of a choice adventure, it didn't really swap some of it. Right after that, you went to another Dreadsylvania choice, exited from it, bought a Dreadsylvania skeleton key and then tried to maximize for mp or something. This time, it had forgotten that you had a fudgecycle equipped and went and "acquired" a new one for you by crafting it out of fudgecules.

It looks to me like you were typing "maximize" commands in the CLI and doing stuff in the Relay Browser - and this time, you went into Dreadsylvania while the maximize command was still running through its equipment changes.

- As I suggested from my own experience, we need to better detect when equipment changes fail. In my case, it was a "stat too low" problem. In your case, it was because you were in a non-interruptable choice adventure. We need to be rock solid about keeping the state of your equipment accurate in the face of such failures.
- The maximize command needs to stop changing equipment when a slot fails for any reason.

I need to think about this some more.
 

fronobulax

Developer
Staff member
Guessing that both of you have the auto-coinmasters enabled, which would acquiring it, if you tell it to, not a bug.

As to why the OP inventory got confused... that would be the buggy question. :) As long as auto-satisfy-coinmasters was on.

I am a little surprised that loading an outfit from the Gear Changer will spend resources at Coin Masters. If that is the desired behavior will it also purchase outfit pieces from the Mall if Mall purchases are allowed, at least for consistency? I'm thinking there is a Feature Request here.
 

Veracity

Developer
Staff member
The "outfit" command calls EquipmentManager.retrieveOutfit(), which insists that every outfit piece is either currently equipped or is fetched via EquipmentManager.retrieveItem() - which will use every method you have authorized: pull from storage, move out of closet, create from components (which is where Coinmaster creations come in; "autoSatisfyWithCoinmaster" determines whether the COINMASTER crafting type is considered; it doesn't actually have anything to do with "purchasing" items), buy from mall.

Selecting an Outfit in the Gear Changer results in an EquipmentRequest on that outfit, which also does EquipmentManager.retrieveOutfit().

I think it's been this way for a long time - ever since we started looking at your list of custom outfits at login and remembering what is in them, as opposed to only knowing what is in the "standard" outfits.

Bottom line is, putting on an outfit will "acquire" all the pieces, and if you authorize "acquire" to spend resources - NPCs, mall, coinmasters - it will do that, if the the resource-free options (equipped, inventory, closet, storage, clan stash) come up empty.
 

chown

Member
Yes, I do sometimes perform actions in the relay browser in parallel with other things (often equipment changes via the CLI or maximizer). Usually, I just visit locations that aren't "stateful" on the KoL side, so (I believe) it doesn't matter. I probably had gotten confused about the Dread non-combats, since I can enter them via pencilled-in links, and then cancel them, without spending adventures. And either I didn't notice my mistake at all, or I immediately forgot about it.

One thing that I was hoping to highlight in my bug report is that, at least in the case of the dreadful sweater, Mafia's state appeared to be inconsistent in a way that I could see from the GUI. As far as I can tell, the Gear Changer GUI's drop-down shouldn't ever list items that the Item Manager lacks. I suspect that the earlier issue with the fudgecycle would have looked similar, had I known to look.

It's entirely understandable that parts of Mafia's state will sometimes not match KoL's, of course. But the truly surprising behavior, to me, is the combination of the Maximizer (or Gear Changer, equivalently) believing an item is available and the item-equipping code believing it is not.

Oh, one other thing: earlier today I had a couple of exceptions appear in my console, with no new DEBUG_* files appearing. This happened on a different machine than I am using at the moment. However, I can produce similar behavior right now, because this one displays an exception whenever I try to open a relay browser:

KoLmafia v16.1 r12988
Released on October 24, 2013

Currently Running on Linux
Local Directory is /mnt/sdb1/kol/kolmafia
Using Java 1.6.0_18

java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.centerkey.BareBonesBrowserLaunch.loadAWTDesktopBrowser(BareBonesBrowserLaunch.java:311)
at com.centerkey.BareBonesBrowserLaunch.loadDefaultUnixBrowser(BareBonesBrowserLaunch.java:234)
at com.centerkey.BareBonesBrowserLaunch.loadUnixBrowser(BareBonesBrowserLaunch.java:205)
at com.centerkey.BareBonesBrowserLaunch.openURL(BareBonesBrowserLaunch.java:51)
at net.sourceforge.kolmafia.webui.RelayLoader.run(RelayLoader.java:108)
Caused by: java.lang.UnsupportedOperationException: Desktop API is not supported on the current platform
at java.awt.Desktop.getDesktop(Desktop.java:126)
... 9 more

This one seems harmless because I can just open a web browser manually and point it at http://127.0.0.1:60080/game.php, and everything seems fine. But my point is that I don't see a new DEBUG file. Should I?
 

Veracity

Developer
Staff member
The Dreadsylvania non-combats are stateful: they send you to choice.php - and yes, you can get out of them by choosing the correct choice - but unlike Trick-or-Treating, for example, you cannot simply walk away from the choice adventure, and the background activity of equipping items simply starts failing.

Yes, I understand that the equipment lists (as shown by the Gear Changer) and the inventory were out of synch. But they ARE different lists; the Gear Changer is not showing you a view of the inventory. It is showing you lists of items which may or may not be in inventory which go in a particular slot. If you own one sweater and it is equipped, you will see it in the Gear Changer - but it is not in inventory.

I believe the core issue is this: if you have one of an item in inventory and you try to equip it, KoLmafia moves it out of inventory and into the equipment slot. If the equip actually failed for some reason and KoLmafia did not notice, it will believe the item is equipped and there is none in inventory. Next time it refreshes status, it learns that the item is NOT equipped - but does not put it back into inventory. Until you refresh status, the Gear Changer will show it in the slot. As soon as you refresh status, the Gear Changer will unselect it, since KoL says that the item is not equipped.

But it is still on the equipment list, since that is everything that is either equipped or in inventory, and you will see it in the Gear Changer. And perhaps the Maximizer looks at those same equipment lists...

The solution, once and for all, is to not remove an item from inventory and put in the equipment slot until KoL gives positive response saying that it has done exactly that. I am not clear on exactly how that is going wrong, although you being in a non-interuptable choice while the EquipmentRequest is being executed certainly seemed to make it happen for you. It is clearly a bug. I will figure it out, eventually.

Regarding your Exceptions while failing to launch the Relay Browser: Open a new bug report for that. I have absolutely no idea what "Desktop API is not supported on the current platform" means, but clearly our package for launching a browser is not working on your system, and we'll have to figure that out elsewhere; it has nothing to do with the problem reported in this thread.
 

Veracity

Developer
Staff member
Bumping since this is about KoLmafia losing track of what is in inventory and what is equipped, which is the main thing I am brooding about, currently.
 

Ryo_Sangnoir

Developer
Staff member
Here's a case I just hit, where Mafia didn't notice when I switched equipment using a chat command, even though it wasn't doing anything else at that time. I'd just finished automating a set of turns, then used chat commands to equip my PvP outfit, switch familiar, and equip different familiar equipment.

Code:
Requests complete.

Equipping "pvp (#1067)".

Welcome back! Away mode disabled.

You get more familiar with Wuredith, your Trick-or-Treating Tot.

Too many matches found, be more specific: fishy wand, li'l candy corn costume.

Equipping li'l candy corn costume.


> pvp loot a nice

Use all remaining PVP attacks to steal loot via A Nice Cold One
Attack 1 of 61
You acquire an item: pretty flower
You challenged tHE eROsIoNseEker and won the PvP fight, 5 to 2!
*** slot familiar: KoL has li'l candy corn costume but KoLmafia has li'l unicorn costume
 
Top