Bug - Fixed infinite loop in volcano: lavaco lamp factory

taltamir

Member
in volcano lavaco lamp factory, if you set the choice adventure "LavaCo Lamp Factory 1" to "empty lava bottle -> full lava bottle" and then run out of empty bottles mafia will go into an infinite loop of trying to click that button and failing
 

fronobulax

Developer
Staff member
That needs to go to a bug report in that section of the forums

I'm confused. Are you saying this is a KoL bug? If so it is appropriate to make a feature request here for KoLmafia to work around a KoL bug, if possible.

(My confusion may also be based on ignorance since I have mo recollection of ever visiting the Volcano).
 

Veracity

Developer
Staff member
(He filed it under Community Support or something and I moved it.)

KoLmafia should revert to Manual Control - which will abort automation - when the user has configured a choice option which is not available. For the large majority of choices, options do not become available or become unavailable, but this is one that does.

This could/should presumably be a general fix, rather than be tied to this particular choice.
 

Veracity

Developer
Staff member
Actually, we already do that. In ChoiceManager.processChoiceAdventure:

Code:
			// Make sure that KoL currently allows the chosen choice

			if ( !ChoiceUtilities.optionAvailable( decision, request.responseText ) )
			{
				KoLmafia.updateDisplay( MafiaState.ABORT, "Requested choice (" + decision + ") for choice #" + choice + " is not currently available." );
				ChoiceCommand.printChoices();
				request.showInBrowser( true );
				return;
			}
So, I require further info. You say "mafia will go into an infinite loop of trying to click that button and failing".
What were you doing? Adventuring via the GUI? Running a script? Clicking "auto" when you encounter the choice in the Relay Browser?
 

taltamir

Member
(He filed it under Community Support or something and I moved it.)
I apologize, I was sure I put it under bug reports, my bad there.
Actually, we already do that. In ChoiceManager.processChoiceAdventure:

Code:
            // Make sure that KoL currently allows the chosen choice

            if ( !ChoiceUtilities.optionAvailable( decision, request.responseText ) )
            {
                KoLmafia.updateDisplay( MafiaState.ABORT, "Requested choice (" + decision + ") for choice #" + choice + " is not currently available." );
                ChoiceCommand.printChoices();
                request.showInBrowser( true );
                return;
            }
So, I require further info. You say "mafia will go into an infinite loop of trying to click that button and failing".
What were you doing? Adventuring via the GUI? Running a script? Clicking "auto" when you encounter the choice in the Relay Browser?
I do 1 turn in lamp factory so mafia auto selects it for adventure. Then I set choice adv in GUI to convert to full lava bottle, then I hit begin button.
Picture showing steps to reproduce:
WRkKxT1.png


results in:
HdEVS2Y.png


Actually, I bet it would also do it with the other craftables in that encounter... let me test it real quick
 

taltamir

Member
Alright, I tested the other options in that NC adventure:
1,970 carat gold -> thin gold wire
confirmed infinite loop

new age healing crystal -> empty lava bottle
confirmed infinite loop

glowing new age healing crystal -> crystaline light bulb
confirmed infinite loop
Also in the above the name is misspelled, "glowing new age healing crystal" is not a thing that exists, the item is called "glowing new age crystal" without the word healing.

crystaline light bulb + insulated wire + heat-resistant sheet meta...
does not actually trigger infinite loop because clicking on it without the materials skips adventure.

colored globs and fuse do not require any mats so they can't fail.
 

Veracity

Developer
Staff member
OK, obviously I misunderstood how KoL handles these choices. There are many places where, if you don't have the necessary condition (materials, whatever), it won't show you the button. Apparently that is not the case here.

Code:
crystaline light bulb + insulated wire + heat-resistant sheet meta...
does not actually trigger infinite loop because clicking on it without the materials skips adventure.
What do you mean "skips adventure"? exits the choice?

Code:
1,970 carat gold -> thin gold wire
confirmed infinite loop

new age healing crystal -> empty lava bottle
confirmed infinite loop

glowing new age healing crystal -> crystaline light bulb
confirmed infinite loop
So these do not "skip adventure" (exit from choice?). What do they say in browser?

Looking at Wiki, every option in this choice has a message appropriate to "missing materials" and an item that you get if you have the materials. Are you saying that one (and only one) will exit the choice if you select it without the appropriate materials?

Code:
colored globs and fuse do not require any mats so they can't fail.
According to the Wiki:

Code:
Use the glob dyer	
You don't have any globs. Well, you don't have any appropriate globs.

With viscous lava globs leads to Dyer Maker
It lists a message for the glob dryer if you don't have viscous globs.

It's just weird that taking a choice without the materials exits the choice for making the lamp housing (and the glob dyer) but not for the others. I'm not sure we have a mechanism to deal with this.

Could I see a DEBUG log of the (beginning of) the infinite loop, please?

Thanks.
 

Veracity

Developer
Staff member
OK, never mind. I found our mechanism for dealing with this. For example, in the Spooky Gravy Barrow, if you don't have inexplicably glowing rock, we will not enter the dark part of the cave, even if you are configured to do that.

I'll code up something similar for the factory floor.
 

taltamir

Member
Sorry for delayed response, I had IRL stuff to do.
What do you mean "skips adventure"? exits the choice?
Yes that is what I meant, sorry for unclear explanation.
If you are in the NC you cannot navigate away from it, you must choose an option. trying to go somewhere redirects you to the NC

If you choose leave it exits the NC
if you choose fuse or globs it will give them and exit the NC (since there are no prerequisite materials)
If you choose Use the chassis assembler then it will either assemble one and exit the NC, or it will tell you that you are missing materials to make it and exit the NC.

If you choose bulber, or squirter, or kiln, or wire puller and you have the materials it will craft one and exit the choice. But if you do not have the required materials it will tell you that those materials are missing and remain in the NC. So you can repeatedly press them and repeatedly get the message about not having required material.
Try revision 19428
Thank you, I will give it a test and if there are any issue I will provide debug results, after rollover.
 

taltamir

Member
Try revision 19428
Alright, I tested it. All 4 options that caused an infinite loop before now just exit the adventure instead. So no more infinite loop there.

I think maybe it should fallback to "show in browser" or display a notification in the gCLI saying something like "you do not have the prerequisite items to craft this, leaving instead".

edit: to clarify, since your patch works, do you still need me to get any debug info?
 
Last edited:

Veracity

Developer
Staff member
No. I just wanted you to test it.

Revision 19441 doesn't leave the choice if you are missing ingredients. Instead, it goes to Manual Control (i.e., "show in browser").
It will stop your automation, but you will have the option to make something else, if you have the ingredients.

I'm marking this fixed.
 
Top