Bug - Fixed Issues with logging choice adventures.

Veracity

Developer
Staff member
The Economist of Scales is a choice adventure which offers options to trade items for other items. Doing so leaves you in the same choice until you eventually say "leave". No problem - supposedly - since KoLmafia handles chains of choices. However there are some weirdnesses associated with this choice that reveal some bugs.

- You gain items and end up in a choice again
- The choice options are noncontiguous; there is a gap.

Here is how we define the choice in ChoiceManager.java:

Code:
		// The Economist of Scales
		new ChoiceAdventure(
			"The Sea", "choiceAdventure310", "Madness Reef",
			new Object[] { new Option( "get 1 rough fish scale", 1, "rough fish scale" ),
				       new Option( "get 1 pristine fish scale", 2, "pristine fish scale" ),
				       new Option( "get multiple rough fish scales", 4, "rough fish scale" ),
				       new Option( "get multiple pristine fish scales", 5, "pristine fish scale" ),
				       new Option( "skip adventure", 6 )  } ),
		// The Economist of Scales
		// This trades 10 dull fish scales in.
		new Object[]{ IntegerPool.get(310), IntegerPool.get(1),
		  ItemPool.get( ItemPool.DULL_FISH_SCALE, -10 ) },
		new Object[]{ IntegerPool.get(310), IntegerPool.get(2),
		  ItemPool.get( ItemPool.ROUGH_FISH_SCALE, -10 ) },
		new Object[]{ IntegerPool.get(310), IntegerPool.get(4),
		  ItemPool.get( ItemPool.DULL_FISH_SCALE, 10 ) },
		new Object[]{ IntegerPool.get(310), IntegerPool.get(5),
		  ItemPool.get( ItemPool.ROUGH_FISH_SCALE, 10 ) },
That works nicely in the Relay Browser; the correct spoilers go on the correct buttons. But look at how a series of interactions with this choice get logged in the session log:

[133154] Madness Reef
Encounter: Heavily Invested in Pun Futures
Took choice 311/1: The Economist of Scales
choice.php?pwd&whichchoice=311&option=1
Encounter: The Economist of Scales
Took choice 310/1: get 1 rough fish scale
choice.php?pwd&whichchoice=310&option=1
Encounter: rough fish scale
You acquire an item: rough fish scale
Took choice 310/4: get multiple pristine fish scales
choice.php?pwd&whichchoice=310&option=4
Encounter: 9 rough fish scales
You acquire rough fish scale (9)
Took choice 310/2: get 1 pristine fish scale
choice.php?pwd&whichchoice=310&option=2
Encounter: pristine fish scale
You acquire an item: pristine fish scale
Took choice 310/5: skip adventure
choice.php?pwd&whichchoice=310&option=5
Encounter: 10 pristine fish scales
You acquire pristine fish scale (10)
Took choice 310/1: get 1 rough fish scale
choice.php?pwd&whichchoice=310&option=1
Encounter: The Economist of Scales
Took choice 310/2: get 1 pristine fish scale
choice.php?pwd&whichchoice=310&option=2
Encounter: The Economist of Scales
Took choice 310/6: unknown
choice.php?pwd&whichchoice=310&option=6
Consider some of the weird things:

[133154] Madness Reef
Encounter: Heavily Invested in Pun Futures
Took choice 311/1: The Economist of Scales
choice.php?pwd&whichchoice=311&option=1
Encounter: The Economist of Scales

You can't see this, but at this point, ChoiceManager.lastChoice is still 311, even though we are now sitting in choice #310. I could tell this because if I typed "choice" in the gCLI, it looked at the page and got the options - but it labeled them with the spoilers for 311, not 310. I fixed the choice command to extract the choice from the page text and it doesn't do that any more, but the bug is still there.

Took choice 310/4: get multiple pristine fish scales
choice.php?pwd&whichchoice=310&option=4

- no, option 4 is something else - but because of the gap (there is no option 3), that is the 4th option in the list.

Took choice 310/5: skip adventure
choice.php?pwd&whichchoice=310&option=5

- same problem

Encounter: 10 pristine fish scales
You acquire pristine fish scale (10)

Is that so. I expect it said "You acquire 10 pristine fish scales" and because it was bold, we though that was the encounter name or something.

Took choice 310/6: unknown
choice.php?pwd&whichchoice=310&option=6

Choice 6 is "skip adventure". But, because of the gap (no option 3), there are not six options defined.

Summary:

- When one choice redirects to another, ChoiceManager.lastChoice wasn't set correctly.
- When logging choices taken, it doesn't seem to recognize that spoilers can have gaps.
- When a choice adventure includes a Results section that grants items which is followed by a choice adventure, it does not find the encounter name from the choice adventure. It finds the item.
 
Top