Bug - Fixed Mafia made a second set of Jeans of Loathing

PeKaJe

Member
So today I notice I'm missing both sea sub-boss pants and I have an extra pair of Jeans of Loathing. Looking back in my logs, I find this:

custom outfit MPRegen

equip pants Pantsgiving

equip off-hand Walford's bucket

equip back old SCUBA tank

equip familiar das boot

cast 1 Cannelloni Cocoon
You gain 204,313 hit points

[10458] Smith 1 Pantaloons of Hatred + 1 Jodhpurs of Violence
You acquire an item: Jeans of Loathing
Crafting used 1 each of Jodhpurs of Violence and Pantaloons of Hatred

equip pants Jeans of Loathing

[10458] The Ice Hole

The MPRegen outfit includes the jeans. The outfit switching and subsequent equipping happened entirely through chat (older chat, in case that's important). The healing and everything up to the adventuring is done by mafia from I clicked the Ice Hole in the relay browser. As a general thing, I've noticed that mafia will sometimes get its internal idea of what you have and don't have confused when equipping through chat, but it's been hard for me to track down a situation that I can replicate reliably. This is the first time it's been so ... costly, though. As I might wear other pieces of loathing gear at times, I'm also wondering what I can do to prevent mafia from automatically making something it thinks I should be wearing, and instead at worst abort and tell me I no longer have something (so I can "refresh all").
 

Veracity

Developer
Staff member
Give us a reproducible example of KoLmafia losing sync with KoL when equipping through chat and I am sure we'll be able to fix it.
 

PeKaJe

Member
Well, one thing I've seen cause it is outfits with off-handed weapons, and then swapping out the off-hand item. It doesn't seem to happen every time or with every combination of off-hand items, though. And in any case, it probably wouldn't be the cause of the above bug, as there is only one place pants should be able to go in that situation. It may be that mafia updates its idea of what you're wearing post-combat, and a bug like the above would only happen if there's some pre-adventure thing to do, like healing up. At any rate, what can I do to prevent mafia from crafting equipment it thinks I should be wearing, but it lost track of?
 

Veracity

Developer
Staff member
It updates your idea of what you are wearing every time it looks at api.php?what=status, which is does for requests submitted via the GUI or scripts whenever KoL indicates that charpane.php is to be refreshed. You say "the outfit switching occurred entirely though chat". What does that mean? You typed ... something ... in chat. Presumably, that made KoL submit ... some request ... which generated a reply, and KoLmafia watched all this happening and updated its model.

What, exactly, did you type into chat?

I am not interested in answering "how do I work around a bug?" questions.
 

Theraze

Active member
In terms of obvious things to avoid, don't tell KoL to do something it can't. Don't try to equip items while in a fight. Don't try to equip items while in a choice.
 

lostcalpolydude

Developer
Staff member
This request isn't necessarily related to the bug mentioned. Someone could make an outfit with these pants, then (for example) closet the pants (carelessness, or maybe a script) and have closet use disabled. If they then try to equip the outfit, making a new set of these pants always seems like the wrong thing to do.

Even if it's a more blunt setting to never do anything to retrieve outfit pieces, it seems reasonable.
 

PeKaJe

Member
In the above example, my chat commands were as follows:

/outfit mpregen
/equip p pantsgiving
/equip o walford
/equip b scuba
/equip f das

It looks like the game replies to the chat request with a inv_equip.php ajax call. It may be that this does not (or does not always) tell that the charpane should be refreshed.
 
Was there a more recent thread for this? Anyway - I went to equip hatred or violence outfits for trick or treating today, discovered they weren't there. But they were last Halloween. Turns out that on 2016.01.29, Mafia decided that I needed another treads of loathing, so it made one from my fuzzy slippers + ass-stompers. Treads were a normal part of my rollover outfit, they have been in inventory for months. That would have been whatever the current jar build was at the time.

Looking back at the session log, it looks like I had them equipped along with the rest of the rollover items, then went to play batfellow. At the time, this was not yet completely accounted for in Mafia, in terms of equipment handling.

After getting a few upgrades in the bat cave research area, and visiting the fabricator, I got in the bat car, and apparently went to adventure in gotpork conservatory. At that point, it looks like Mafia decided to cast cocoon and try and re-equip the outfit that I had gone in with. Somehow, it managed to create the treads - apparently it could do that, even though I was in batfellow. It also looks like it tried to purchase a time-bandit towel, a sneaky pete's jacket and a fudgecycle, and attempted to build another number-wang (it started to look for dubious peppermints).

So - was this expected to have been fixed before 1/29? Was it only because of the state of the batfellow support at the time? Or is there perhaps something more that may still need to be looked into?

So much for semi-retirement into aftercore; I'll need to get that stuff again. Eh, I needed motivation anyway ;-)

I can post the session log if it's of interest, but otherwise, perhaps consider this an FYI about another way to have gotten burned this way.

EDIT: added log excerpt.

Code:
equip hat Hairpiece On Fire

equip weapon alarm accordion

equip back Time Bandit Time Towel

equip shirt Sneaky Pete's leather jacket

equip pants Pantaloons of Hatred

equip acc1 fudgecycle

equip acc2 Treads of Loathing

equip acc3 numberwang

equip familiar solid shifting time weirdness

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=%22Batfellow+comic%22
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=%22Mr.+Accessory%22
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=%22yellow+puck%22

mallsell: 1 Batfellow comic

manageprices.php?action=update&price0[8203]=999999998&limit0[8203]=0&price0[8487]=999999998&limit0[8487]=0&price0[8674]=999999998&limit0[8674]=0&price0[8001]=250000&limit0[8001]=0&price0[8831]=999999998&limit0[8831]=0&price0[7999]=100000&limit0[7999]=0&price0[7588]=999999998&limit0[7588]=0&price0[8006]=100000&limit0[8006]=0&price0[8008]=8000000&limit0[8008]=0&price0[8007]=8000000&limit0[8007]=0&price0[8009]=8000000&limit0[8009]=0&price0[8184]=999999998&limit0[8184]=0&price0[8016]=250000&limit0[8016]=0&price0[8392]=50000&limit0[8392]=0&price0[8639]=999999998&limit0[8639]=0&price0[8706]=999999998&limit0[8706]=0&price0[8010]=13000000&limit0[8010]=0&price0[194]=40000000&limit0[194]=0&price0[8657]=250000&limit0[8657]=0&price0[8658]=250000&limit0[8658]=0&price0[8656]=250000&limit0[8656]=0&price0[8381]=999999998&limit0[8381]=0&price0[8260]=999999998&limit0[8260]=0&price0[8564]=999999998&limit0[8564]=0&price0[7983]=20000000&limit0[7983]=0&price0[8000]=250000&limit0[8000]=0&price0[8002]=2000000&limit0[8002]=0&price0[8003]=2000000&limit0[8003]=0&price0[8005]=2000000&limit0[8005]=0&price0[8004]=2000000&limit0[8004]=0&price0[8705]=999999998&limit0[8705]=0&price0[8287]=999999998&limit0[8287]=0&price0[8795]=999999998&limit0[8795]=0
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=%22Batfellow+comic%22
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=%22Batfellow+comic%22

use 1 Batfellow comic
Encounter: Batfellow Begins
Took choice 1133/1: Read the comic
choice.php?pwd&whichchoice=1133&option=1
> CHIT: Error parsing start of charpane
> CHIT: Error parsing start of charpane

place.php?whichplace=batman_cave&action=batman_cave_rnd
Encounter: Bat-Research and Bat-Development
Took choice 1136/1: Bat-Suit upgrades
choice.php?pwd&whichchoice=1136&option=1
Encounter: Bat-Suit Upgrades
Took choice 1137/11: Back to Main R&D Menu
choice.php?pwd&whichchoice=1137&option=11
Encounter: Bat-Research and Bat-Development
Took choice 1136/2: Bat-Sedan upgrades
choice.php?pwd&whichchoice=1136&option=2
Encounter: Bat-Sedan Upgrades
Took choice 1138/11: Back to Main R&D Menu
choice.php?pwd&whichchoice=1138&option=11
Encounter: Bat-Research and Bat-Development
Took choice 1136/3: Bat-Cavern upgrades
choice.php?pwd&whichchoice=1136&option=3
Encounter: Bat-Cavern Upgrades
Took choice 1139/11: Back to Main R&D Menu
choice.php?pwd&whichchoice=1139&option=11
Encounter: Bat-Research and Bat-Development
Took choice 1136/2: Bat-Sedan upgrades
choice.php?pwd&whichchoice=1136&option=2
Encounter: Bat-Sedan Upgrades
Took choice 1138/1: Rocket Booster
choice.php?pwd&whichchoice=1138&option=1
Encounter: Bat-Sedan Upgrades
> CHIT: Error parsing start of charpane
> CHIT: Error parsing start of charpane
Took choice 1138/11: unknown
choice.php?pwd&whichchoice=1138&option=11
Encounter: Bat-Research and Bat-Development
Took choice 1136/1: Bat-Suit upgrades
choice.php?pwd&whichchoice=1136&option=1
Encounter: Bat-Suit Upgrades
Took choice 1137/1: Hardened Knuckles
choice.php?pwd&whichchoice=1137&option=1
Encounter: Bat-Suit Upgrades
> CHIT: Error parsing start of charpane
> CHIT: Error parsing start of charpane
Took choice 1137/2: unknown
choice.php?pwd&whichchoice=1137&option=2
Encounter: Bat-Suit Upgrades
> CHIT: Error parsing start of charpane
> CHIT: Error parsing start of charpane
Took choice 1137/11: unknown
choice.php?pwd&whichchoice=1137&option=11
Encounter: Bat-Research and Bat-Development
Took choice 1136/6: Stop Researching and Developing
choice.php?pwd&whichchoice=1136&option=6
--------------------
The Bat-Cavern's Bat-Fabricator	buy	3	bat-oomerang	ROW782
--------------------
--------------------
8797	bat-oomerang	872551869	batarang.gif	none	q	0
# Item bat-oomerang: Deals 20 damage and disarms foes
--------------------
--------------------
The Bat-Cavern's Bat-Fabricator	buy	3	bat-jute	ROW783
--------------------
--------------------
8798	bat-jute	117347429	lasso.gif	none	q	0
# Item bat-jute: Lets you tie up and interrogate a weakened foe
--------------------
--------------------
The Bat-Cavern's Bat-Fabricator	buy	3	bat-o-mite	ROW784
--------------------
--------------------
8799	bat-o-mite	970970954	minamite.gif	none	q	0
# Item bat-o-mite: Defeats most foes in one shot
--------------------

place.php?whichplace=batman_cave&action=batman_cave_car
Encounter: The Bat-Sedan
Took choice 1135/5: (secret choice)
choice.php?whichchoice=1135&option=5&pwd
> CHIT: Error parsing start of charpane
Unknown Adventure #464 = adventure.php?snarfblat=464
Unknown Adventure #464 = adventure.php?snarfblat=464
Unknown Adventure #464 = adventure.php?snarfblat=464

cast 1 Cannelloni Cocoon

equip hat Hairpiece On Fire

equip weapon alarm accordion

mall.php?category=allitems&consumable_byme=0&weaponattribute=3&wearable_byme=0&nolimits=0&max_price=0&sortresultsby=price&justitems=0&x_cheapest=0&pudnuggler=%22Time+Bandit+Time+Towel%22
mall.php?category=allitems&consumable_byme=0&weaponattribute=3&wearable_byme=0&nolimits=0&max_price=0&sortresultsby=price&justitems=0&x_cheapest=0&pudnuggler=%22Time+Bandit+Time+Towel%22
mall.php?category=allitems&consumable_byme=0&weaponattribute=3&wearable_byme=0&nolimits=0&max_price=0&sortresultsby=price&justitems=0&x_cheapest=0&pudnuggler=%22Sneaky+Pete%27s+leather+jacket%22
mall.php?category=allitems&consumable_byme=0&weaponattribute=3&wearable_byme=0&nolimits=0&max_price=0&sortresultsby=price&justitems=0&x_cheapest=0&pudnuggler=%22Sneaky+Pete%27s+leather+jacket%22
mall.php?category=allitems&consumable_byme=0&weaponattribute=3&wearable_byme=0&nolimits=0&max_price=0&sortresultsby=price&justitems=0&x_cheapest=0&pudnuggler=%22fudgecycle%22

[60235] Smith 1 Fuzzy Slippers of Hatred + 1 Ass-Stompers of Violence
You acquire an item: Treads of Loathing
Crafting used 1 each of Ass-Stompers of Violence and Fuzzy Slippers of Hatred

equip acc2 Treads of Loathing

pull: 5 dubious peppermint

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

equip familiar solid shifting time weirdness
Unknown Adventure #464 = adventure.php?snarfblat=464&confirm4=on
Unknown Adventure #464 = adventure.php?snarfblat=464&confirm4=on
Unknown Adventure #464 = adventure.php?snarfblat=464&confirm4=on
Unknown Adventure #464 = adventure.php?snarfblat=464&confirm4=on

[60235] Unknown Adventure #464
Encounter: Gotpork Conservatory
Unknown Adventure #464 = adventure.php?snarfblat=464
Unknown Adventure #464 = adventure.php?snarfblat=464
Unknown Adventure #464 = adventure.php?snarfblat=464
Unknown Adventure #464 = adventure.php?snarfblat=464

[60235] Unknown Adventure #464
Encounter: low-level mook
Round 0: fractalnavel wins initiative!
Round 0: fractalnavel casts CHANCE!
Encounter: low-level mook
Round 0: fractalnavel loses initiative!
--------------------
8806	high-grade explosives	923060960	potion15.gif	none	q	0
# Item high-grade explosives: Can be used in the Bat-Cavern's Bat-Fab to make Bat-o-mite
--------------------
Round 1: low-level mook takes 10 damage.
Round 1: fractalnavel wins the fight!
You acquire an item: high-grade explosives
Unknown Adventure #464 = adventure.php?snarfblat=464
Unknown Adventure #464 = adventure.php?snarfblat=464
Unknown Adventure #464 = adventure.php?snarfblat=464
Unknown Adventure #464 = adventure.php?snarfblat=464
 
Last edited:

Veracity

Developer
Staff member
Mind boggling - since, for me, when I am in Batfellow, Mafia is well aware that "Cocoon" is not a skill I know. Limitmode, and all that. It also knows that I have no saved outfits.
 
Yeah, it's all very strange. I can see Mafia *attempting* to do stuff like that if the batfellow limitmode wasn't quite all there at the time, but the fact that it actually succeeded - weird.
 

Xande1

Member
KoL unequips all your gear when you start Batfellow. Back before mafia had Batfellow limitmode support (which was the case when your event happened) mafia would "lose track" of whatever you were wearing, since it had vanished off of your character, and mafia didn't realize it went to your inventory. My memory indicates that since Batfellow limitmode support was added to Mafia, that no longer happens (but I should double-check the next time I play Batfellow, my memory isn't what it used to be).

As for mafia successfully smithing while in Batfellow.... I got nothing. That's really strange.
 
I guess I could try to create something else from the gCLI while in batfellow limitmode. I haven't been playing them in a while (still got to get my 20 in).

No, not anymore, the gear handling was one of the first things addressed. Smashing Treads gives an epic wad, doesn't it? Making lemons out of lemonade... er...
 

lostcalpolydude

Developer
Staff member
I basically removed those recipes from mafia (by marking them MANUAL), so if this somehow comes up again mafia will just give an error instead of making another piece of loathing equipment.
 

Veracity

Developer
Staff member
So, JLE said:

KOLMafia bought me an extra pair of saffron pants for no reason two days ago - I was charging up Pantsgiving for the 50-turn second extra point of fullness, but at the end of the series of adventures, for no reason, it decided to not only change my pants to the saffron ones, but buy a new pair ignoring the one that was already there in my inventory.
Ignoring the "for no reason" part - there had to be a reason, just not a desirable one ;) - this seems like another case of KoLmafia losing track of a previously worn item which was moved into inventory. Pants, in particular. Which was always hard to understand, since there should be no ambiguity about which item is in your pants slot.

So, this was probably a 4-million-Meat screwup (20 chakra sludges). Certainly not as bad as the error that prompted this thread, but, oof.

JLE sent me his complete session log and full details about outfits and such. I am hoping I can figure out what might have happened and fix it - and that, perhaps (hopefully, likely), it was the same issue as this one.
 

Veracity

Developer
Staff member
The essence of JLE's log:

Code:
custom outfit Chakras

equip pants Pantsgiving

(Automate X turns)

Trade 200 negative lump, 20 chakra sludge
You acquire an item: saffron antaravasaka

equip pants saffron antaravasaka
The Chakras outfit includes the saffron pants.

We save and restore your current outfit around automation.

Therefore, at the beginning of automation, we thought he was wearing the saffron pants, at the end we knew that he was not (because api.php during automation recorded the current equipment), and when it went to restore the outfit, it didn't find the saffron pants in inventory, so it made more.

Therefore, "equip pants Pantsgiving" did the equip (from KoL's viewpoint) but we did not update our model to show it.

His "outfit" commands were via chat. I suspect that the "equip" was done that way too, although my query about that did not get a reply.

Compare this to PeKaJe's original report and it is identical, except instead of automating adventuring saving & restoring an outfit, it was automated restoration before starting an adventure - which also saves and restores an outfit.

The common factor seems to be:

/outfit X
/equip pants Y

and we do not correctly update our model to have pants Y in place of the pants that were in outfit X.

That is puzzling, since the chat command sends javascript down to the browser which responds by sending up an inv_equip.php request with ajax=1, and when we get the response for that, we SHOULD parse the "Item Unequipped" and "Item Equipped" messages, just as we do when we submit the request ourself.

During the "automated" activity, KoL periodically asks for charpane.php which we replace with api.php, since we are automating, which gives us the equipment array which we simply "set"; rather than "switching" the current equipment with the new one (which will move old items from an equipment slot to inventory and new items from inventory to equipment slots, which will keep inventory in synch, we don't touch our idea of inventory. So, in this case, the pants from outfit X will not be in inventory and pants Y will still be in inventory.

There are two places where we "set" the equipment like that.

- at the end of EquipmentManager.switchEquipment (which manipulates inventory as described)
- as a result of api.php/what=status

There seem to be two "solutions":

1) Figure out how/why/when "/equip SLOT ITEM" does NOT result in us updating our model correctly
2) Make our parsing of api.php use EquipmentManager.switchEquipment, passing it our idea of your current equipment as the "old" equipment and the equipment array from api.php as the "new" equipment, thus updating inventory as expected.

I am still puzzled about #1 and would love to see how it could happen, but #2 should prevent the kind of havoc that PeKaJe and JLE reported.

I suppose we could also report when api.php actually changes our model from what we expect. That might help with thinking about #1.
 

Veracity

Developer
Staff member
Revision 17739 will now use switchEquipment, rather than setEquipment, to update our model of equipped items from api.php. And unless we are refreshing (at log in, for example), we will log to the gCLI and session log every slot where our model differs from KoL's.

We don't actually expect to see such logging, but if we do, perhaps looking at what happened just prior will help us figure out issue #1: how did our models diverge?

In any case, hopefully this will fix the kind of thing that PeKaJe and JLE experienced, since we will move formerly equipped items to inventory, rather than simply losing track of them.

Which is to say, this Bug should be fixed, although I have not diagnosed the root cause of the model discrepancy yet.
 

AlbinoRhino

Active member
This is from my session log. I was running some script that meat-farms embezzlers which I have been using quite a while without noticing any issues. I have included some context from the session log around the new logging statements but, as I'm not sure what other information you might need, you'll have to let me know.

> COMMAND: embez
> Putty sheet is on hand.
> Doh box is on hand.


fax receive
You acquire an item: photocopied monster
> MEAT DROP PRE-BUFF = +110%
> snsStickers.ash start
> m=meat i=items inf=list d=remove all
> Using: sword
> scratch 'n' sniff UPC sticker (3) retrieved
> sticker1 = UPC
> sticker2 = UPC
> sticker3 = UPC
> snsStickers.ash end


pool aggressive
You acquire an effect: Billiards Belligerence (10)


pool aggressive
You acquire an effect: Billiards Belligerence (10)


pool aggressive
You acquire an effect: Billiards Belligerence (10)


use 1 "DRINK ME" potion
You acquire an effect: Down the Rabbit Hole (20)


equip hat filthy knitted dread sack


Visiting the Mad Tea Party
Encounter: The Mad Tea Party
Took choice 441/1: Try to get a seat
choice.php?pwd&whichchoice=441&option=1
You acquire an effect: Dances with Tweedles (30)


equip hat plexiglass pith helmet


summon Red'xen'gar
You acquire an effect: Preternatural Greed (30)


concert 2
You acquire an effect: Winklered (20)


familiar Hobo Monkey (58 lbs)


Unequip Chocolate Lab


equip familiar astral pet sweater
custom outfit frmash_meat
*** slot weapon: KoL has garbage sticker but KoLmafia has scratch 'n' sniff sword
*** slot off-hand: KoL has scratch 'n' sniff sword but KoLmafia has garbage sticker



maximize meat drop


bjornify Happy Medium (47 lbs)
> buffs_setup complete


use 1 red snowcone
You acquire an effect: Red Tongue (20)


pull: 1 peppermint twist


use 1 peppermint twist
You acquire an effect: Peppermint Twisted (10)


pull: 1 resolution: be wealthier


use 1 resolution: be wealthier
You acquire an effect: Greedy Resolve (20)


pull: 1 Meat-inflating powder


use 1 Meat-inflating powder
You acquire an effect: Big Meat Big Prizes (20)
 

AlbinoRhino

Active member
I'm not sure if this is related, but thought I would mention it. I have noticed before that when my rollover script equips the disembodied hand with a time sword, and then the hand gets placed back into the terrarium, mafia thinks I have 1 less time sword unless I go into the terrarium and unequip the sword. So it appears there is the potential for hats, pants and weapons to "disappear" into the terrarium.
 
Top