Bug - Fixed You're on your own, partner.

bumcheekcity

Active member
This could be a bug or a scripting error with a couple of scripts, but I can't work out what it is. When using BCA to fight through the Hidden City, it does so correctly until it gets to the final fight. It cleared the liana fine, then on the fight with the spirit I get:

Code:
BCC: levelMe(85, true) called.
Level 10 Starting
BCC: We have completed the stage [airship].
BCC: We have completed the stage [castle].
BCC: levelMe(104, true) called.
Level 11 Starting
BCC: We have completed the stage [macguffinprelim].
BCC: We have completed the stage [macguffinpalin].
BCC: We have completed the stage [hits].
BCC: We have completed the stage [macguffinspooky].
BCC: We have completed the stage [macguffinpyramid].
BCC: We have not completed the stage [macguffinhiddencity].
BCC: Maximizing '-weapon, '
Maximizing...
4 combinations checked, best score 5,149.75
BCC: Switching Familiar for General Use
BCC: Going to try to use some spleen items if you have them.
BCC: Going to try to use some spleen items if you have them.
Spleen: 4 Agua: 0 Stick: 0 Token: 0 Grease: 0 Dream Jar: 0
Total Spleen: 4
BCC: Nothing to fax according to whatShouldIFax
Resetting mind control device...
Mind control device reset.
Cleared mood.
Cleared mood.
Set mood trigger: When I get Just the Best Anapests, uneffect just the best anapests
Set mood trigger: When I run low on Power Ballad of the Arrowsmith, cast 1 The Power Ballad of the Arrowsmith
Set mood trigger: When I run low on Rage of the Reindeer, cast 1 Rage of the Reindeer
Mood swing complete.
Mood swing complete.
BCC: Defeating the last Protector Spectre.
Conditions list cleared.
BCC: Setting goals of '1 choiceadv'...
Condition added: Choices Left: 1
BCC: We should set the MCD if we can.
BCC: We CAN set the MCD.
Resetting mind control device...
Mind control device reset.

Request 1 of 171 (HiddenCity: A Massive Ziggurat) in progress...

[782] A Massive Ziggurat
Encounter: Legend of the Temple in the Hidden City
Legend of the Temple in the Hidden City
Encounter: Protector Spectre
Strategy: C:\Users\Admin\Desktop\Dropbox\KoLMafia\ccs\WHAM.ccs [default]
Round 0: bumcheekcity wins initiative!
You're on your own, partner.
You're on your own, partner.
You're on your own, partner.
You're on your own, partner.
You're on your own, partner.

And then the last line repeats ad infinitum. The thing that I don't get is that the line that generates it in BCA is very simple:

Code:
	//10 - Fight boss. 
	if (item_amount($item[stone triangle]) == 4) {
		set_property("choiceAdventure791", "1");
		equip($slot[weapon], $item[antique machete]);
		bumAdv($location[A Massive Ziggurat], "-weapon, ", "", "1 choiceadv", "Defeating the last Protector Spectre.");
	}

As is clear, bumAdv() manages to get all the way through the massive function that it is to hit the adventure() function. My CCS is set to, simply:

Code:
[ default ]
consult WHAM.ash

It could be a BCA problem, could be a WHAM problem, could be a Mafia problem, could be any one of the three - but I just can't work it out. I turned debugging on for the script and attach the debug log, although it's all a bit greek to me. If it's a mafia bug, here's the report. If it's an ASH bug, could someone tell me what tells me that in the below debug log?

View attachment DEBUG_20131212.txt
 

Veracity

Developer
Staff member
Code:
    <p>
      You creep up to the mummy and poke it with your weapon. Nothing happens, so you poke it again, a little more bravely.
    <p>
      Nothing happens. Satisfied, you reach for the amulet.
    <p>
      With a shriek of rage, a ghostly, luminescent spectre leaps from the mummy and reaches for your throat with spectral claws.
  <center>
    <p>
      You get the jump on him.
    <p>
    <p>
    <center>
      <table>
        <tbody>
          <tr>
            <td align="center">
Starting consult script: WHAM.ash
Finished consult script: WHAM.ash
Starting consult script: WHAM.ash
Finished consult script: WHAM.ash
You're on your own, partner.
Starting consult script: WHAM.ash
Finished consult script: WHAM.ash
You're on your own, partner.
Starting consult script: WHAM.ash
Finished consult script: WHAM.ash
You're on your own, partner.
Starting consult script: WHAM.ash
Finished consult script: WHAM.ash
You're on your own, partner.
Starting consult script: WHAM.ash
Finished consult script: WHAM.ash
You're on your own, partner.
Starting consult script: WHAM.ash
Finished consult script: WHAM.ash
You're on your own, partner.
Starting consult script: WHAM.ash
Finished consult script: WHAM.ash
You're on your own, partner.
Starting consult script: WHAM.ash
Finished consult script: WHAM.ash
You're on your own, partner.
You found the protector spectre.
You had WHAM set up as your consult script.
Wham failed to kill the monster and returned to KoLmafia.
You told it to continue the combat with WHAM
Wham failed to kill the monster and returned to KoLmafia.
This continues ad infinitum

I'm not sure why KoLmafia didn't just abort your script when it said "You're on your own" because the combat aborted.
 

Veracity

Developer
Staff member
I tried this.

CCS:

Code:
[ default ]
consult booger.ash
booger.ash:

Code:
void main( int round, string name, string page )
{
    print( "round = " + round + " monster = " + name );
}
Execution:

> ash adventure( 1, $location[ top floor ] )

Changing "top floor" to "The Castle in the Clouds in the Sky (Top Floor)" would get rid of this message ()

pre-adventure

Visit to Beanstalk: The Castle in the Clouds in the Sky (Top Floor) in progress...

[433788] The Castle in the Clouds in the Sky (Top Floor)
Encounter: Raver Giant
Strategy: brianna [default]
Round 0: Brianna wins initiative!
round = 1 monster = raver giant
round = 1 monster = raver giant
You're on your own, partner.
Click here to continue in the relay browser.
From the debug log:

Code:
Requesting: http://www.kingdomofloathing.com/adventure.php?snarfblat=324
Retrieved: http://www.kingdomofloathing.com/adventure.php?snarfblat=324
Field: Location = [fight.php?ireallymeanit=1386869150]
Requesting: http://www.kingdomofloathing.com/fight.php?ireallymeanit=1386869150
Retrieved: http://www.kingdomofloathing.com/fight.php?ireallymeanit=1386869150
Starting consult script: booger.ash
round = 1 monster = raver giant
Finished consult script: booger.ash
Starting consult script: booger.ash
round = 1 monster = raver giant
Finished consult script: booger.ash
You're on your own, partner.
Since the only line in the CCS is the call to the consult script, that will be called repeatedly.

Round 1:

KoLmafia calls the consult script.
The consult script doesn't actually do any actions; it prints the line and returns.
The following code in FightRequest executes:

Code:
				if ( KoLmafia.refusesContinue() )
				{
					FightRequest.nextAction = "abort";
				}
				else if ( initialRound == FightRequest.currentRound )
				{
					if ( FightRequest.nextAction == null )
					{
						FightRequest.nextAction = "abort";
					}
					else if ( FightRequest.nextAction.equals( FightRequest.consultScriptThatDidNothing ) )
					{
						FightRequest.nextAction = "abort";
					}
					else
					{
						FightRequest.consultScriptThatDidNothing = FightRequest.nextAction;
					}
				}
We did not abort, !KoLmafia.refusesContinue().
The round number did not change, so the "else if" clause executes.
nextAction == "consult booger.ash" and consultScriptThatDidNothing == null
Therefore, we set consultScriptThatDidNothing to "consult booger.ash"

Round 1 redux:

KoLmafia calls the consult script.
The consult script doesn't actually do any actions; it prints the line and returns.
We did not abort, !KoLmafia.refusesContinue().
The round number did not change, so the "else if" clause executes.
nextAction = "consult booger.ash" and consultScriptThatDidNothing == "consult booger.ash"
Therefore, we set nextAction to "abort"

Round 1 redux redux:

nextAction = "abort".
KoLmafia aborts.

Near as I can tell, this duplicates the situation you described:

- CCS is a call to a consult script
- adventure( 1, location)
- the consult script does no actions, but simply returns.

The difference is that in your case, it continues trying to do the same fight, continues calling the consult script, which continues to do nothing.

I conclude that your script is doing more than a simple "adventure( 1, location)".
 
Last edited:

Winterbay

Active member
BumAdv does the following when it actually starts to adventure:
Code:
    if (can_interact()) {
        if (adventure(my_adventures(), loc, "consultCasual")) {}
    } else if (consultScript != "") {
        if (adventure(my_adventures(), loc, consultScript)) {}
    } else if (my_primestat() == $stat[Mysticality] && in_hardcore()) {
        if (adventure(my_adventures(), loc, "consultMyst")) {}
    } else {
        if (adventure(my_adventures(), loc)) {}
    }

So it will try to run all your turns. The call for the function specifies "1 choiceadv" as the goal which can be seen in the output posted worked fine. The problem is that I think that goal is not deemed as cleared until the adventure has been run meaning that if we never successfully exit the choiceadventure with our fight the script will continue on until the goal is met and thus continue failing for ever and ever if the fight doesn't resolve.
 

bumcheekcity

Active member
But would that not mean that the "You're on your own..." message would only display my_adventures() number of times? It was certainly running tens of thousands of times before.
 

Winterbay

Active member
Well, it never takes a turn so I guess it would continue forever. I'm pretty certain that adventure() will do however many actions in the place you told it to go as it can and a "free action" doesn't count.
 

bumcheekcity

Active member
View attachment DEBUG_20131231.txt

I encountered the same thing, with the same monster, when not using a script. My CCS was set to use WHAM (no other lines), and I chose to adventure three times in the Ziggarut when I had all three Lianas cleared. I instantly got the "You're on your own..." message, with no rounds of combat fought. The same happened when I set it to adventure once and once only in the Ziggarut.

Debug log attached. I turned debugging on for the fight.
 

Veracity

Developer
Staff member
Round 1: protector spectre heals 1 hit points.
Starting consult script: WHAM.ash
Finished consult script: WHAM.ash
Starting consult script: WHAM.ash
Finished consult script: WHAM.ash
You're on your own, partner.
Starting consult script: WHAM.ash
Finished consult script: WHAM.ash
You're on your own, partner.

Starting consult script: WHAM.ash
Finished consult script: WHAM.ash
You're on your own, partner.
You're on your own, partner.
You're on your own, partner.
You're on your own, partner.
 

Veracity

Developer
Staff member
(I did not set this to "Not a Bug". I am confused as to why it did not abort when it said "You're on your own, partner".)
 

Bale

Minion
I did not set this to "Not a Bug".

I did that. I figured it was a WHAM issue, not a mafia issue. I'll set it to "bug" since you think mafia should be aborting. Personally I thought that mafia was supposed to keep reiterating the final line in a CCS. Since that last line is WHAM, I didn't see it as a bug that mafia kept running WHAM.
 
Last edited:

Winterbay

Active member
WHAM will loop until BatBrain tells it that the fight is over, but in this case it'snot WHAM that is looping but Mafia :)
Even if WHAM had aborted, as it appears to have done, it does not seem to have helped.
 

Veracity

Developer
Staff member
Even if WHAM had aborted, as it appears to have done, it does not seem to have helped.
If by "abort" you mean "return without doing a fight action", yes, that's what it is doing. And, after it does that twice, KoLmafia, effectively, marks it as useless for this fight and does an actual abort, which is supposed to stop the automation. It does, for me, when I tested it last time.

I don't have time right now to look again at this, but something is fishy.
 

Veracity

Developer
Staff member
Just to clarify - WHAM did NOT "abort" by calling the abort() or abort( "message" ) function, which would have told KoLmafia to end automation immediately. It simply exited, leaving KoLmafia to figure out that since the round did not advance after calling WHAM twice, that there was no point in calling it yet again.
 

Winterbay

Active member
That is curious because as coded the script either loops throwing stuff (items or skills) at whatever it is facing until it (or you) is dead or it exits with an abort("") due to not finding a safe enough way of killing it.
It would be interesting to get the output from WHAM that was printed during that debug log as well to see what it thought that it was doing. Preferably at zlib verbosity of 9 for maximum output.
 

Veracity

Developer
Staff member
It would be interesting to get the output from WHAM that was printed during that debug log as well to see what it thought that it was doing. Preferably at zlib verbosity of 9 for maximum output.
Assuming you mean "the output that WHAM did via print()", that should be in the session log.

it exits with an abort("")
Seriously? Just an empty string? Why not an informative message?

Well, that SHOULD leave KoLmafia in an ABORT state. How curious.
 

Veracity

Developer
Staff member
Some tests:

1) With this consult script:

Code:
void main( int round, string name, string page )
{
    abort( "round = " + round + " monster = " + name );
}

Automating for 3 rounds gave me this:

Validating adventure sequence...

Request 1 of 3 (Beanstalk: The Castle in the Clouds in the Sky (Top Floor)) in progress...

[429828] The Castle in the Clouds in the Sky (Top Floor)
Encounter: Raver Giant
Strategy: chondara [default]
Round 0: Chondara wins initiative!
round = 1 monster = raver giant
You're on your own, partner.
The abort() function printed the specified string and sent KoLmafia into an ABORT state and it stopped automating. Check.

2) With this consult script:

Code:
void main( int round, string name, string page )
{
    print( "round = " + round + " monster = " + name );
    abort( "" );
}
I got this:

Validating adventure sequence...

round = 1 monster = raver giant

You're on your own, partner.
The abort() function printed a blank line and sent KoLmafia into an ABORT state and it stopped automating. Check.

3) With this consult script:

Code:
void main( int round, string name, string page )
{
    print( "round = " + round + " monster = " + name );
}
I got:

Validating adventure sequence...

round = 1 monster = raver giant
round = 1 monster = raver giant
You're on your own, partner.
The consult script executed and exited without doing anything other than printing a message.
Since nothing followed it in the CCS, KoLmafia ran it again and it did the same thing.
Since it ran twice with no progress, KoLmafia aborted the combat. Check.

Note that BCC's debug log showed this behavior for WHAM - running it twice and then KoLmafia aborts - which is consistent with WHAM simply returning, not calling abort( "" ).

Not that that really matters; it continued trying to automate the fight after aborting - which is precisely the behavior I am not seeing when I attempt to reproduce it.
 

Winterbay

Active member
Assuming you mean "the output that WHAM did via print()", that should be in the session log.


Seriously? Just an empty string? Why not an informative message?

Well, that SHOULD leave KoLmafia in an ABORT state. How curious.

It does exit with a message, using "" was my way of indicating a string in short hand rather than indicating an empty string :)
 
Top