Bug - Fixed Breakfast should not go grey as if it was successful if "encountering lag"

Raijinili

Member
Code:
...
Using 1 set of jacks...
You gain 15 Sarcasm
Finished using 1 set of jacks.
Using 1 burrowgrub hive...
Unexpected error, debug log printed.
Finished using 1 burrowgrub hive.
Using 1 glass gnoll eye...
Finished using 1 glass gnoll eye.
Searching for "chewing gum on a string"...
Search complete.
Searching for "chewing gum on a string"...
Search complete.
You need 1 more chewing gum on a string to continue.
Unable to acquire 1 worthless items.

Harvesting your garden
Collecting cut of hippy profits...
Casting Advanced Cocktailcrafting 5 times...
Encountered lag problems.
Casting Advanced Saucecrafting 8 times...
Encountered lag problems.
Casting Pastamastery 3 times...
Encountered lag problems.
Casting Summon Stickers 3 times...
Encountered lag problems.
Casting Summon Alice's Army Cards 1 times...
Encountered lag problems.
(file not found)
0 prices updated from http://kolmafia.us/scripts/updateprices.php?action=getmap
...

I would expect executing "breakfast" again would make it try all of those things, but the spells aren't tried again. I would also expect the button not to be greyed out.

Code:
> breakfast

Visiting Potted Meat Bush in clan rumpus room
Using 1 Manual of Transmission...
Finished using 1 Manual of Transmission.
Using 1 set of jacks...
Finished using 1 set of jacks.
(usable quantity of burrowgrub hive is limited to 0 by daily limit)
Using 1 glass gnoll eye...
You acquire an item: breath mint
Finished using 1 glass gnoll eye.
Searching for "chewing gum on a string"...
Search complete.
Purchasing chewing gum on a string (1 @ 50)...
You acquire an item: chewing gum on a string
You spent 50 Meat
Purchases complete.
Using 1 chewing gum on a string...
You acquire an item: worthless knick-knack
Finished using 1 chewing gum on a string.
Visiting the Hermit...
Searching for "hermit permit"...
Search complete.
Purchasing hermit permit (1 @ 100)...
You acquire an item: hermit permit
You spent 100 Meat
Purchases complete.
Visiting the Hermit...
Hermit successfully looted!
Hermit successfully looted!
Searching for "chewing gum on a string"...
Search complete.
Purchasing chewing gum on a string (3 @ 50)...
You acquire chewing gum on a string (3)
You spent 150 Meat
Purchases complete.
Placing items into closet...
Using 3 chewing gum on a string...
You acquire an item: worthless gewgaw
You acquire an item: worthless knick-knack
You acquire an item: worthless trinket
Finished using 3 chewing gum on a string.
Removing items from closet...
You acquire an item: worthless knick-knack
Visiting the Hermit...
Searching for "hermit permit"...
Search complete.
Purchasing hermit permit (3 @ 100)...
You acquire hermit permit (3)
You spent 300 Meat
Purchases complete.
Visiting the Hermit...
You acquire ten-leaf clover (4)
Using 4 ten-leaf clover...
You acquire disassembled clover (4)
Finished using 4 ten-leaf clover.
Hermit successfully looted!
Hermit successfully looted!

Background info: I have an Internet connection that cuts out when the AC starts grinding.
 

roippi

Developer
The button (I'm assuming you mean daily deeds) is enabled/disabled by the breakfastCompleted preference. How do you expect setting that preference to work in the presence of lag? If one command out of the lot gets eaten by lag it doesn't get set? Three? Seven? I don't see the way that works getting changed. If you want to manually run breakfast again, nothing stops you.

Now for the summons.. without looking at the source code, I'll bet that the respective preferences get set when the request is sent, and not when the response is received. The latter way is the preferable method, so that is worth refactoring.
 

Veracity

Developer
Staff member
I looked at the code last night and the properties are incremented when we receive the response. The "Encountered lag problems" message is printed in that function when we get a blank page and no further processing is done.
 

roippi

Developer
Hm. Seems like the summons should have fired the second time.

Raijinili - Did you try "cast pastamastery" or some equivalent at the CLI after this happened?
 

fronobulax

Developer
Staff member
For the record, at least part of the issue, IMO is that the breakfastCompleted preference is really a breakfastAttemptedOnce preference. I looked at tweaking it but the complexity exceeded my ability at the time and I have not revisited it since.
 

Veracity

Developer
Staff member
The breakfastCompleted preference is really a breakfastAttemptedOnce preference.
Not true.

Code:
		boolean done = true;

		done &= castSkills( recoverMana, 0 );
		done &= castBookSkills( recoverMana, 0 );

		Preferences.setBoolean( "breakfastCompleted", done );
Until both "castSkills" or "castBookSkills" return true, breakfastCompleted is false and KoLmafia will try running breakfast again on login, and castSkills and castBookSkills will try to do more summoning.

I think the following code at the top of castSkills is suspect:

Code:
		String skillSetting =
			Preferences.getString( "breakfast" + ( KoLCharacter.canInteract() ? "Softcore" : "Hardcore" ) );

		if ( skillSetting == null )
		{
			return true;
		}
...since Preferences.getString returns "" if you don't have the setting, not null.

The problem is this code in castSkill:

Code:
		UseSkillRequest summon = UseSkillRequest.getInstance( skillName );
...
		summon.setBuffCount( castCount );
		RequestThread.postRequest( summon );

		return castCount == maximumCast;
...which does a UseSkillRequest and claims that it is done if it attempted to cast the maximum remaining summons.

As it turns out, this public variable in UseSkillRequest:

Code:
	public static String lastUpdate = "";
... is "" after a successful request and is an error message if not, so we can easily tell if the request completed successfully.

castBookSkill has a similar issue.

Should I fix this, or leave this as an exercise for the fresh young devs? :)
 

fronobulax

Developer
Staff member
I stand corrected. I based my statement on the observation that UseSkillRequest returned based upon claim not accomplishment. Thank you.
 
Top