Bug - Fixed Inaccurate spleen tracking at low levels

Salculd

New member
Luckily, the reason for that seems to be pretty straightforward!

I attempted to use a glimmering roc feather at level 3 via the automatic [use] link on acquisition, and while it failed since you have to be at least 4 to use one, my spleen counter still updated +4 as if it had succeeded. It also removed the item from my displayed inventory until I did a hard item refresh.
 

Salculd

New member
Additionally, it's now officially Later In The Day and my spleen counter is maxed out, but it's displaying 11/15 right now. Unfortunately, I didn't notice that until just now, so I'm not sure at what point that happened.

The spleen hits I've used today in order, in case it'd help:
2 concentrated magic pills (via automatic "use" link on guild unlock)
1 moxie weed (via the same)
1 glimmering roc feather as described above
1 glimmering roc feather that worked for real via "use" on the consumable pane in the relay browser
2 coffee pixie stick via "use multiple" on the consumable pane in the relay browser

I don't have the capacity to check whether the counter will still fix itself if I try to use a spleen item now, but if I'm able to I'll check and edit this to include it.

edit: Yeah, as usual that still fixes it.
 
Last edited:

lostcalpolydude

Developer
Staff member
The message for a failed use is "You need to be at least level 4 to use that item." Adding
Code:
		if ( responseText.indexOf( "You need to be at least level 4 to use that item." ) != -1 )
		{
			UseItemRequest.lastUpdate = "You are too weak to use that.";
			KoLmafia.updateDisplay( KoLConstants.ERROR_STATE, UseItemRequest.lastUpdate );
			
			return;
		}
somewhere in src/net/sourceforge/kolmafia/UseItemRequest.java should fix it, but I'm not sure where. I see that there's already level-checking code for seals, maybe those blocks could be combined.
 

AtGNAT

New member
Fullness counter increases when failing to eat high-level food.

When using the /eat command in chat for a food item which had a level requirement higher than my level, KolMafia detected that I was trying to eat and increased the food counter despite the food not actually being eaten.

I cannot remember for certain if I was using KoLmafia Chat or the chat frame in the web browser, although I believe it was the latter.

I don't expect this to matter, but the food was spaghetti with Skullheads.

I am using v14.3 r8903. (I am assuming that running the .exe rather than the .jar includes the updates from the last .jar that I ran, and that all updates include all the previous updates. If either or both of these assumptions are horrible n00b mistakes, I would appreciate being corrected.)
 

Winterbay

Active member
Depending on what you mean by "includes updates from the last .jar" you could be correct and not :)

Does the KoL Mafia window state v14.3 r8903 at the top when you run it? If so that appears to be the latest version. If you ran the r8903 jar once and then some older .exe file then this would not be so, and you would do better running the .jar version instead.
 

Grotfang

Developer
This seems to confuse a lot of people.

AtGNAT: From the beginning:

There are two .exe files.

One of them is downloadable from the project site at sourceforge (here). It is currently called KoLmafia-14.3.exe.

The second one is not downloadable from the daily builds page (here). It used to be, though. It is called KoLmafia.exe.

Both of them are out of date.

You can use a .jar file downloadable from the daily builds page posted above. The top one in that list is the most up to date version of KoLmafia you can get.

Here's the well kept secret though... they all run in essentially the same way! If you run an out of date .exe, you may as well be running the .jar it is built from (8694 for 14.3.exe, 87xx something for the old daily build one). Running a newer jar then running an older exe just means you're running the older exe.

In summary, use the jars.

Anyways, that being said, are you able to replicate this using an up to date jar file? If so, you've found a bug :)
 

Rinn

Developer
Pretty sure this occurs with spleen items as well, I noticed this happening with agua before hitting level 4 a while ago.
 

Veracity

Developer
Staff member
I can easily believe it. This is related to the "when we detect you were too full to eat, we fail to roll back your fullness" bug. This would be a "when we detect that eating failed for any other reason, we fail to roll back your fullness."

The real issue is that we increment fullness when you submit the URL to eat and have to undo it later. That's not current "best practice" for how we handle requests to KoL. Here's a brief technical discussion.

Each kind of request can be submitted in two ways: from the GUI or CLI (i.e., under KoLmafia's control) or from the Relay Browser or visit_url (i.e., direct user action with KoLmafia not knowing exactly what is happening).
Each kind of request has a registerRequest method which examines the URL and writes to the session log.
Each kind of request SHOULD have a processResults method (which is called for KoLmafia-submitted requests), which calls some sort of "parse" method with the URL and response text. The "parse" method is also called StaticEntity.externalUpdate to handle Relay Browser and visit_url submitted requests.

The registerRequest SHOULD do nothing but logging, and the "parse" method is the place to check for success in the response text and, based on the URL, update KoLmafia's internal data model if the request was successful - and leave it untouched if the request failed. Given that, there would be no need to "roll back fullness" or other aspects of the data model.

Unfortunately, UseItemRequest updates fullness - and various preferences and such - in registerRequest, NOT in the "parse" method. LOTS of request classes used to operate that way, and I spent many many hours rewriting them to operate according to what I described above. Unfortunately, UseItemRequest is very complicated, since there are many kinds of items which can be used and there are many ways in which using can succeed or fail.

In summary: the best fix for this would be to move fullness updating into UseItemRequest.parseConsumption and only do it if eating succeeded. Ditto for inebriety and spleen.

I don't have time. Perhaps somebody else will tackle it - or, at least, will "roll back" fullness if we detect the "you can't eat that" message, whatever it is.
 

AtGNAT

New member
re: Always runnig using the .jar rather than the .exe -- Thanks.

re: Replicating the bug -- Scrounging a Queen cookie and trying with that probably wouldn't inconvenience me too much, but from other people's comments (such as Veracity saying why there is a problem and how to fix it) it seems that it is pretty much confirmed.
 
Last edited:

Theraze

Active member
What would be useful from you is the exact message that it gives in the relay browser/KoL itself when eating fails. That's what we'd need to be able to patch this.
 

AtGNAT

New member
As per Theraze's request, using a queen cookie (a relatively easy high-level food to get with KoLmafia's Solve! button...)

The central frame said:
Results:

chesscookie.gif

Your palate isn't sophisticated enough to eat food this good.

(You must be at least level 13 to eat this item.)

Obviously, "Your palate isn't sophisticated enough to eat food this good." is the important bit, since this should apply to things other than queen cookies.

Both the chat frame and KoLmafia's Graphical CLI tab say "Ingesting a queen cookie." but make no mention of the failure.
 
Last edited:

Theraze

Active member
Okay... this patch should work. I'm still in HC so I can't tell if it works or not, but it should. Matching on "must be at least level" since that seems more generic than the palate message. Basically took the "too full" section, and removed the part where it tries to recalculate how many items you can actually eat, since if you're out of level the answer will be 0.
 
Last edited:

AtGNAT

New member
This probably should go in another thread, but I'm a bad person and the spleen problem is basically the same as the stomach problem.

With a spleen item, the message I got was...

You need to be at least level 9 to use that item.

Note that it is you need to be, not you must be.

I do not have a convenient way of testing the booze message right now, but it isn't really relevant to this bug since KoLmafia just asks the Kingdom how drunk we are. (I guess it might be somewhat inconvenient if KoLmafia stops believing that you have a drink in your inventory, however.)
 

Theraze

Active member
Sure... I'll spin a new patch for "be at least level" instead and attach it to this post. It's all related, long as alcohol works the same. :)
 

Attachments

  • ConsumptionLevel.patch
    1.5 KB · Views: 24
Last edited:

roippi

Developer
While I'm in there fixing this:

Does this happen with non-spleen items, too? i.e. if I tried to eat a lo mein at level 3. I don't see anything in UseItemRequest that rolls back food/drunk if responseText indicates that you are too low a level.
 

Theraze

Active member
Yeah... here's the duplicate thread with fixing-patch attached. Unfortunately the message is different for different types of consumables, but I think the text "be at least level" remains consistent between them.
 

roippi

Developer
Urgh.. someone really should refactor UseItemRequest to update character states by parsing responses rather than just on requests. Unfortunately there's a mountain of hardcoded stuff in there that would need to be fixed. A rather nontrivial undertaking.

I'll probably just do the "rollback" method for now.
 
Top