Bug - Not A Bug adv1 returns false for "choiceless" choice adventures

Malibu Stacey

Active member
I noticed adv1 was sometimes returning false when we didn't expect it to so I wrote some code to log when it happens and return true if we think it was erroneous.

Code:
	string previousEncounter = get_property("lastEncounter");
	int turncount = my_turncount();
	boolean advReturn = adv1(loc, -1, option);
	if (!advReturn) {
		auto_log_info("adv1 returned false for some reason. Did we actually adventure though?", "blue");
		if (get_property("lastEncounter") != previousEncounter) {
			auto_log_info(`Looks like we may have adventured, lastEncounter was {previousEncounter}, now {get_property("lastEncounter")}`, "blue");
			advReturn = true;
		}
		if (my_turncount() > turncount) {
			auto_log_info(`Looks like we may have adventured, turncount was {turncount}, now {my_turncount()}`, "blue");
			advReturn = true;
		}
	}
	return advReturn;

Searching my session logs for "adv1 returned false for some reason" turns up the following:

Code:
[337] A Mob of Zeppelin Protesters
Preference lastEncounter changed from This Looks Like a Good Bush for an Ambush to Not So Much With The Humanity
Encounter: Not So Much With The Humanity
Preference questL11Ron changed from step1 to step2
> [INFO] - adv1 returned false for some reason. Did we actually adventure though?
> [INFO] - Looks like we may have adventured, lastEncounter was This Looks Like a Good Bush for an Ambush, now Not So Much With The Humanity
See https://kol.coldfront.net/thekolwiki/index.php/Not_So_Much_With_The_Humanity

Code:
[354] The Upper Chamber
Preference lastEncounter changed from Iiti Kitty to Down Dooby-Doo Down Down
Encounter: Down Dooby-Doo Down Down
Preference middleChamberUnlock changed from false to true
Preference questL11Pyramid changed from started to step1
> [INFO] - adv1 returned false for some reason. Did we actually adventure though?
> [INFO] - Looks like we may have adventured, lastEncounter was Iiti Kitty, now Down Dooby-Doo Down Down
> [INFO] - Looks like we may have adventured, turncount was 353, now 354
See https://kol.coldfront.net/thekolwiki/index.php/Down_Dooby-Doo_Down_Down

Code:
[357] The Middle Chamber
Preference lastEncounter changed from tomb rat to Further Down Dooby-Doo Down Down
Encounter: Further Down Dooby-Doo Down Down
Preference lowerChamberUnlock changed from false to true
Preference questL11Pyramid changed from step1 to step2
> [INFO] - adv1 returned false for some reason. Did we actually adventure though?
> [INFO] - Looks like we may have adventured, lastEncounter was tomb rat, now Further Down Dooby-Doo Down Down
> [INFO] - Looks like we may have adventured, turncount was 356, now 357
See https://kol.coldfront.net/thekolwiki/index.php/Further_Down_Dooby-Doo_Down_Down

Code:
[361] The Middle Chamber
Preference lastEncounter changed from tomb rat to Under Control
Encounter: Under Control
Preference controlRoomUnlock changed from false to true
Preference questL11Pyramid changed from step2 to step3
> [INFO] - adv1 returned false for some reason. Did we actually adventure though?
> [INFO] - Looks like we may have adventured, lastEncounter was tomb rat, now Under Control
> [INFO] - Looks like we may have adventured, turncount was 360, now 361
See https://kol.coldfront.net/thekolwiki/index.php/Under_Control

Code:
[398] A-Boo Peak
Preference lastEncounter changed from The Horror... to Come On Ghosty, Light My Pyre
Encounter: Come On Ghosty, Light My Pyre
Preference booPeakLit changed from false to true
> [INFO] - adv1 returned false for some reason. Did we actually adventure though?
> [INFO] - Looks like we may have adventured, lastEncounter was The Horror..., now Come On Ghosty, Light My Pyre
> [INFO] - Looks like we may have adventured, turncount was 397, now 398
See https://kol.coldfront.net/thekolwiki/index.php/Come_On_Ghosty,_Light_My_Pyre

Code:
[404] Oil Peak
Preference lastEncounter changed from oil cartel to Unimpressed with Pressure
Encounter: Unimpressed with Pressure
Preference oilPeakLit changed from false to true
> [INFO] - adv1 returned false for some reason. Did we actually adventure though?
> [INFO] - Looks like we may have adventured, lastEncounter was oil cartel, now Unimpressed with Pressure
> [INFO] - Looks like we may have adventured, turncount was 403, now 404
See https://kol.coldfront.net/thekolwiki/index.php/Unimpressed_with_Pressure

If you look at the linked wiki pages, they are all "choiceless" non-combats as in there's nothing at all to do you just get the adventure shown to you with no choice to click. There's no way you can "fail" that adventure but adv1 is still returning false for some reason.

My logs are from Normal Standard runs hence I believe there are adventures I haven't listed that would also exhibit the same issue like the building extremity on the eXtreme slope (autoscend just pulls the ninja climbing gear in Normal runs to skip that) since they are also "choiceless".

Thanks.
 

Veracity

Developer
Staff member
I'm ready to look at this now. A "choice adventure" is a subset of a "noncombat" which includes a choice form. A "noncombat" with no choice form is just a "noncombat".
 

Veracity

Developer
Staff member
I understand why it is doing that. All of those adventures put KoLmafia into the "PENDING" state. That means "stop automating because something happened that might mean that your script will want to adventure somewhere else." And for all those examples, that is exactly the case.

Not So Much With The Humanity - you have cleared the Mob of Zeppelin protestors. Time to go to the Red Zeppelin.
Down Dooby-Doo Down Down - you have opened the Middle Chamber. Go there?
Further Down Dooby-Doo Down Down - you have opened the Lower Chamber. Go there? (Probably not).
Under Control - You have opened the Control Room. Go There? (Maybe, if you have enough wheels and/or tomb ratchets)
Come On Ghosty, Light My Pyre - You have lit the fire on A-Boo Peak. Go somewhere else.
Unimpressed with Pressure - You have lit the fire on Oil Peak. Go somewhere else.

Every one of those puts KoLmafia in PENDING, and if you are automating multiple adventures - either in the GUI or via adventure() - it stops automation without running more turns in that location.

For adv1, you only want a single turn - but it still returns a boolean reflecting whether or not you should reconsider adventuring again in that location.

If it returns true, you adventured successfully and consumed a turn.
If it returns false, either you failed to adventure (ran out of turns, whatever), or it adventured successfully but you hit one of the "You might be done adventuring here. Look at lastEncounter and see why."

This is behaving as intended.

You say "it is returning false when you weren't expecting it to." Your script SHOULD be "expecting" each of those events, right? You are expecting to get the NC telling you that you are done with Zeppelin protesters, right? How are you detecting that? Checking lastEncounter? Well, adv1 is telling you that this is a good time to do that check.

This is not a bug.
 

taltamir

Member
I understand why it is doing that. All of those adventures put KoLmafia into the "PENDING" state. That means "stop automating because something happened that might mean that your script will want to adventure somewhere else." And for all those examples, that is exactly the case.

Not So Much With The Humanity - you have cleared the Mob of Zeppelin protestors. Time to go to the Red Zeppelin.
Down Dooby-Doo Down Down - you have opened the Middle Chamber. Go there?
Further Down Dooby-Doo Down Down - you have opened the Lower Chamber. Go there? (Probably not).
Under Control - You have opened the Control Room. Go There? (Maybe, if you have enough wheels and/or tomb ratchets)
Come On Ghosty, Light My Pyre - You have lit the fire on A-Boo Peak. Go somewhere else.
Unimpressed with Pressure - You have lit the fire on Oil Peak. Go somewhere else.

Every one of those puts KoLmafia in PENDING, and if you are automating multiple adventures - either in the GUI or via adventure() - it stops automation without running more turns in that location.

For adv1, you only want a single turn - but it still returns a boolean reflecting whether or not you should reconsider adventuring again in that location.

If it returns true, you adventured successfully and consumed a turn.
If it returns false, either you failed to adventure (ran out of turns, whatever), or it adventured successfully but you hit one of the "You might be done adventuring here. Look at lastEncounter and see why."
returning false to indicate either failure or success so great you completed the quest in that zone makes this boolean value non meaningful
false should just mean failure, true should just mean success. if there is need to report a "we probably finished a quest" it should really be done via a different variable instead.
You say "it is returning false when you weren't expecting it to." Your script SHOULD be "expecting" each of those events, right? You are expecting to get the NC telling you that you are done with Zeppelin protesters, right? How are you detecting that? Checking lastEncounter? Well, adv1 is telling you that this is a good time to do that check.

This is not a bug.
The script always checks the current state of quests rather than relying on on adv1 returning false when it successfully adventured to be notified that something might have changed and that the conditions need to be rechecked.
 

taltamir

Member
Alright then. I adjusted the documentation to include it.
As ashref links to a wiki page which said it returns false only when failed to adventure.
 
Top