Is there a problem with Vamp Out support? Or does choice-goal not work from a script?

Bale

Minion
I'm working on a script, the relevant portion of which is this:


Code:
void vamp_out(int choice) {
	// Equip Fangs
	cli_execute("checkpoint");
	if(equipped_amount($item[plastic vampire fangs]) < 1 && retrieve_item(1, $item[plastic vampire fangs]))
		equip($item[plastic vampire fangs]);
	// Vamp Out
	set_property("choiceAdventure546", choice); 
	visit_url("town.php?action=vampout");
	cli_execute("choice-goal");
	// Restore Outfit
	cli_execute("outfit checkpoint");
}

The problem is that it does not go to choice-goal. It does everything else, including entering the Interview with You. Then it tries to restore my outfit. (Obviously that doesn't work although mafia is oblivious to the fact.) I can type choice-goal in the CLI to reach my destination. Here's my output:

Code:
> call vampout_deed 1

Internal checkpoint created.
Putting on plastic vampire fangs...
Equipment changed.
choiceAdventure546 => 1
Putting on Hodgman's lucky sock...
Equipment changed.

> choice-goal

Encounter: Interview With You - Goal Mistified
Action: Visit Vlad's Boutique
Action: Stalk the Night
Action: Go for the Bum
Action: Visit the Castle
Action: To the Boudoir!
Action: Feed the Undead Hussies
Action: Skulk in the Cemetery
Action: Rob the Grave
Action: Reach for the Sky
You acquire an effect: Mistified (duration: 30 Adventures)

Here's a second, differently strange failure, but at least mafia knows it is failing this time:


Code:
> call vampout_deed 12

Internal checkpoint created.
Putting on plastic vampire fangs...
Equipment changed.
choiceAdventure546 => 12
Encounter: Interview With You - Goal Pride of the Vampire and Interview With You (a Vampire)
Action: Visit The Masquerade
Action: Visit Isabella's
Action: See Where the Night Takes You
[COLOR="#FF0000"]Manual control requested for choice #546
[U]Click here to continue in the relay browser.[/U][/COLOR]

[B]choice 1[/B]: Visit Vlad's Boutique
[B]choice 2[/B]: Visit Isabella's
[B]choice 3[/B]: Visit The Masquerade

Checking the relay browser reveals that it failed at the choices of: Drain Her Dry, Redirect Your Desire, Tell Her How You Feel which are part of Isabella's Boutinque, not the Masquerade. I think that means it messed up by not realizing the first choice would be gone when it previously visited vlad's boutique?
 

Bale

Minion
Oh dear. Then maybe the problem is interview with you support? It seems to mess up on the first choice. Rinn?
 

Catch-22

Active member
Have you tried on the Dawn of The First Day?

Er.. I mean, have you tried after rollover for the first time? The VampOutManager logic becomes more complicated with each consecutive Vamp Out, so try that if you haven't.
 

Bale

Minion
I probably missed a lesson somewhere. I know how to get a debug log, but how do I make it "verbosely log"?
 

Catch-22

Active member
I probably missed a lesson somewhere. I know how to get a debug log, but how do I make it "verbosely log"?

Ah, that's what I get for using brevity :) Under the extra debugging options settings panel, could you tick the box that says "verbosely log communication between KoLmafia and browser".
 

Bale

Minion
Done. Same thing happened. I have not previously done any vamping out today.

Code:
> call vampout_deed 1

Internal checkpoint created.
Putting on plastic vampire fangs...
Equipment changed.
choiceAdventure546 => 1
Putting on Mr. Accessory Jr....
Equipment changed.

> choice-goal

Then I visit the relay browser. It shows me the first option for Interview With You. Apparently Vlad's Boutique has not yet been chosen.

Code:
> choice-goal

Encounter: Interview With You - Goal Mistified
Action: Visit Vlad's Boutique
Action: Stalk the Night
Action: Go for the Bum
Action: Visit the Castle
Action: To the Boudoir!
Action: Feed the Undead Hussies
Action: Skulk in the Cemetery
Action: Rob the Grave
Action: Reach for the Sky
You acquire an effect: Mistified (duration: 30 Adventures)

My rather large debug log is attached. In case anyone is curious, here is the script. I activated it from the Daily Deed panel. You can see in the script how it is defined as a Daily Deed.

PHP:
script "Vamp Out Daily Deed";
notify <Bale>;

void insert_deed() {
	string vlad = '$CUSTOM|Combo|Vlad|_interviewVlad|$ITEM|Mistified|false|call vampout_deed 1|$ITEM|Bat Attitude|false|call vampout_deed 2|$ITEM|There Wolf|false|call vampout_deed 3';
	string isabella = '$CUSTOM|Combo|Isabella|_interviewIsabella|$ITEM|Muscle|false|call vampout_deed 4|$ITEM|Mysticality|false|call vampout_deed 5|$ITEM|Moxie|false|call vampout_deed 6|$ITEM|111 Meat & lose 1-2 hp|false|call vampout_deed 7';
	string masquerade = '$CUSTOM|Combo|Masquerade|_interviewMasquerade|$ITEM|Prince and Sword|false|call vampout_deed 8|$ITEM|Prince and Sceptre|false|call vampout_deed 9|$ITEM|Prince and Medallion|false|call vampout_deed 10|$ITEM|Prince and Chalice|false|call vampout_deed 11|$ITEM|Pride and Book|false|call vampout_deed 12|$ITEM|your own black heart|false|call vampout_deed 13';
	
	if(!dailyDeedsOptions.contains_text("_interviewVlad")) {
		set_property("dailyDeedsOptions", dailyDeedsOptions+","+vlad);
		dailyDeedsOptions = get_property("dailyDeedsOptions");
	}
	if(!dailyDeedsOptions.contains_text("_interviewIsabella")) {
		set_property("dailyDeedsOptions", dailyDeedsOptions+","+isabella);
		dailyDeedsOptions = get_property("dailyDeedsOptions");
	}
	if(!dailyDeedsOptions.contains_text("_interviewMasquerade"))
		set_property("dailyDeedsOptions", dailyDeedsOptions+","+masquerade);
	
	print("Daily Deeds for Vamping Out have been added!", "green");
}

// Error message
boolean print_error(string error) {
	print(error, "red");
	return false;
}

// Verify that the choice is good
boolean check_choice(int choice) {
	if(available_amount($item[plastic vampire fangs]) < 1)
		return print_error("You don't have any plastic vampire fangs.");
	if(choice > 13 || choice < 1)
		return print_error("invalid option for Vamping Out");
	if(choice < 4) {
		if(get_property("_interviewVlad") == "true")
			return print_error("You've already Vamped Out with Vlad today.");
	} else if(choice < 8) {
		if(get_property("_interviewIsabella") == "true")
			return print_error("You've already Vamped Out with Isabella today.");
	} else if(get_property("_interviewMasquerade") == "true")
		return print_error("You've already Vamped Out at the Masquerade today.");
	return true;
}

void vamp_out(int choice) {
	// First let's make sure that some soft of Fubar didn't send us here.
	if(check_choice(choice)) {
		// Equip Fangs
		cli_execute("checkpoint");
		if(equipped_amount($item[plastic vampire fangs]) < 1 && retrieve_item(1, $item[plastic vampire fangs]))
			equip($item[plastic vampire fangs]);
		// Vamp Out
		set_property("choiceAdventure546", choice); 
		visit_url("town.php?action=vampout");
		cli_execute("choice-goal");
		// Restore Outfit
		cli_execute("outfit checkpoint");
	}
}

// If vamp_choice is 0, it will create a daily deed.
void main (int vamp_choice) {
	if(vamp_choice == 0)
		insert_deed();
	else
		vamp_out(vamp_choice);
}
 

Attachments

  • DEBUG_20120628.txt
    230.7 KB · Views: 84
Last edited:

Catch-22

Active member
My rather large debug log is attached.

Ah, I assume this also contains you manually completing the choice in the relay browser, coz it includes a bunch of irrelevant javascript.

Looking at your debug log though, it seems like there is something a bit strange with the choice-goal code, from what I can tell the choice.php doesn't even get visited until you override it in the relay.

Code:
                     [NORMAL] <- ""
                        Param #1: "choice-goal"
                        [NORMAL] <- "choice-goal"
                        Entering function cli_execute
                        Function cli_execute returned: true
                     [NORMAL] <- true
                        Param #1: "outfit checkpoint"
                        [NORMAL] <- "outfit checkpoint"
                        Entering function cli_execute

You'd think there would be more stuff going on between cli_execute("choice-goal") and outfit checkpoint.
 

Bale

Minion
Ah, I assume this also contains you manually completing the choice in the relay browser, coz it includes a bunch of irrelevant javascript.

Quite. I couldn't be sure that choice-goal might not reveal something interesting or useful. It covers everything that I copy/pasted from the CLI output.

If you search for "Mr. Accessory Jr" you can find the part where it tried to restore my original outfit checkpoint which is the end of the first part.


from what I can tell the choice.php doesn't even get visited until you override it in the relay.

That seems quite strange indeed. I hope someone can figure out why.
 

Catch-22

Active member
More weirdness.

Manual control requested for choice #546
choice 1: Visit Isabella's

>Manual control requested for choice #546
choice 1: Visit Isabella's

> choice 1

Manual control requested for choice #546
choice 1: Visit Isabella's

> choice 1

Manual control requested for choice #546
choice 1: Visit Isabella's


In the end I had to pick Visit Isabella's from the relay browser.
 

Catch-22

Active member
That seems quite strange indeed. I hope someone can figure out why.

I figured it out. There's some really badly formed HTML in the forms of Interview With You. I think when KoLmafia reconstructs the request it freaks out because the HTML form is so badly done. This isn't the first time I've seen invalid HTML in KoL before, but it's probably the worst case I've seen in a while. They are also notorious for not ending <p> tags (or using them instead of <br />). Are they coding this stuff in Notepad? :|

PHP:
<form name=choiceform1 action=choice.php method=post><input type=hidden name=pwd value='006f8b1e7fad993f0ddb8bb61f47b738'><input type=hidden name=whichchoice value=546><input type=hidden name=option value=1><input class=button type=submit value="You know what? Never mind."></form>

Any HTML novice will be able to tell you what's so terribly wrong with this.

Here's more bad HTML from the same page...
<Center><centeR>
lol wtf?

Edit: Oh yes, I should probably mention that I filed a bug report in KoL for this one.
 
Last edited:

Catch-22

Active member
From Eleron (#1564433)

KoL (Jick) doesn't really follow HTML standards, and there are some really nasty examples of that around.

That being said, for this issue, unquoted attribute values are not a particularly bad thing.

See [link] http://www.w3.org/TR/html-markup/syntax.html#attr-value-unquoted

(If this causes *actual problems for you* in a web browser you use, report it as such and there's a chance Jick or CDM will fix it. Though then you should probably report it to the browser maker too.)


I replied saying that it causes problems with the KoLmafia relay browser but I don't like our chances of getting this fixed KoL-side. Perhaps we will have to revisit the way the form is being reconstructed in KoLmafia.

Edit: Yep, being told that this needs to be handled KoLmafia-side.
 
Last edited:
Top