Bug - Fixed r10747 - Louvre troubles

Fluxxdog

Active member
Not sure what happening here, but I keep running in to this:
Code:
<repeated a bunch of times before I hit ESC>
[4054] Haunted Gallery
Encounter: Louvre It or Leave It
Now turn your head and cough...
Raiding the fridge...
Getting pumped up...
Pumpkin bombs are ready to throw!
You need 123 thin black candles. You can farm at the Giant's Castle.
You're running low on milk of magnesium. Might want to be a sauceror.
Checkpoints cleared.
Ready for battle!
Script abort.

> choice-goal

> choice

You aren't in a choice adventure.

> help choice

choice [number|text] - list or choose choice adventure options.
choice-goal - automatically complete quest.

> choice 1

You aren't in a choice adventure.
That isn't one of your choices.

[4054] Haunted Gallery
Encounter: Louvre It or Leave It
Encounter: Louvre It or Leave It (Escher: Relativity)
Encounter: Louvre It or Leave It (Munch: The Scream)
Encounter: Louvre It or Leave It (Seurat: Sunday Afternoon on the Island of La Grande Jatte)
You gain 330 Fortitude
You gain a Muscle point!
And then everything works perfectly fine after that. I have no debug log printed out, so if there's any problem I can trying running debugging after rollover.
 

Veracity

Developer
Staff member
Now turn your head and cough...
Raiding the fridge...
Getting pumped up...
Pumpkin bombs are ready to throw!
You need 123 thin black candles. You can farm at the Giant's Castle.
You're running low on milk of magnesium. Might want to be a sauceror.
Checkpoints cleared.
That was printed after KoLmafia detected that you were in the Louvre. Sure looks like your script is screwing you up. Why do you think this is a KoLmafia bug?
 

Fluxxdog

Active member
Because the part you quoted is from a bBS script in the middle of a choice adventure, never selecting a choice. What gets me is the first time it happens, it gets caught up. cli:choice-goal and cli:choice are not detecting that it was in a choice adventure. "choice 1" seems to have sent the choice anyway despite it telling me I'm not in a choice adventure and then automatically went to the Muscle boost. After I take care of the choice adventure, it doesn't get caught up again at all. This leads me to think, for some reason mafia doesn't pick up that it's in the choice adventure. It only happens in the Louvre to boot.
Will debugging even help with this or am I the only person this happens to?
I dug through my session log to see if I could find anything that might help, though I' don't think so:
Code:
[4046] Haunted Gallery
Encounter: Out in the Garden
Took choice 89/3: Dreams and Lights
choice.php?whichchoice=89&option=3&pwd
You acquire an effect: Dreams and Lights (duration: 10 Adventures)
 > Now turn your head and cough...
 > Raiding the fridge...
 > Getting pumped up...
 > Pumpkin bombs are ready to throw!
 > You need 123 thin black candles. You can farm at the Giant's Castle.
 > You're running low on milk of magnesium. Might want to be a sauceror.
 > Ready for battle!

[4047] Haunted Gallery
Encounter: cubist bull
Round 0: fluxxdog wins initiative!
Round 0: fluxxdog uses the Rain-Doh indigo cup!
You gain 253 hit points
Round 1: fluxxdog casts MIGHTY AXING!
Round 2: cubist bull takes 777 damage.
Round 2: fluxxdog wins the fight!
You gain 446 Meat
You gain 15 Strongness
You gain 14 Mysteriousness
You gain 15 Roguishness
You gain a Moxie point!
 > Now turn your head and cough...
 > Raiding the fridge...
 > Getting pumped up...
 > Pumpkin bombs are ready to throw!
 > You need 123 thin black candles. You can farm at the Giant's Castle.
 > You're running low on milk of magnesium. Might want to be a sauceror.
 > Ready for battle!

[4048] Haunted Gallery
Encounter: guy with a pitchfork, and his wife
Round 0: fluxxdog wins initiative!
Round 0: fluxxdog uses the Rain-Doh indigo cup!
You gain 253 hit points
Round 1: fluxxdog casts MIGHTY AXING!
Round 2: guy with a pitchfork, and his wife takes 760 damage.
Round 2: fluxxdog wins the fight!
You gain 213 Meat
You gain 24 Beefiness
You gain 14 Enchantedness
You gain 8 Smarm
 > Now turn your head and cough...
 > Raiding the fridge...
 > Getting pumped up...
 > Pumpkin bombs are ready to throw!
 > You need 123 thin black candles. You can farm at the Giant's Castle.
 > You're running low on milk of magnesium. Might want to be a sauceror.
 > Ready for battle!

[4049] Haunted Gallery
Encounter: guy with a pitchfork, and his wife
Round 0: fluxxdog wins initiative!
Round 0: fluxxdog uses the Rain-Doh indigo cup!
You gain 253 hit points
Round 1: fluxxdog casts MIGHTY AXING!
Round 2: guy with a pitchfork, and his wife takes 748 damage.
Round 2: fluxxdog wins the fight!
You gain 235 Meat
You acquire an item: pitchfork
You gain 22 Fortitude
You gain 13 Wizardliness
You gain 12 Chutzpah
 > Now turn your head and cough...
 > Raiding the fridge...
 > Getting pumped up...
 > Pumpkin bombs are ready to throw!
 > You need 123 thin black candles. You can farm at the Giant's Castle.
 > You're running low on milk of magnesium. Might want to be a sauceror.
 > Ready for battle!

[4050] Haunted Gallery
Encounter: empty suit of armor
Round 0: fluxxdog wins initiative!
Round 0: fluxxdog uses the Rain-Doh indigo cup!
You gain 253 hit points
Round 1: fluxxdog casts MIGHTY AXING!
Round 2: empty suit of armor takes 796 damage.
Round 2: fluxxdog wins the fight!
You acquire an item: antique helmet
You gain 27 Strengthliness
You gain 14 Mysteriousness
You gain 7 Roguishness
 > Now turn your head and cough...
 > Raiding the fridge...
 > Getting pumped up...
 > Pumpkin bombs are ready to throw!
 > You need 123 thin black candles. You can farm at the Giant's Castle.
 > You're running low on milk of magnesium. Might want to be a sauceror.
 > Ready for battle!

[4051] Haunted Gallery
Encounter: cubist bull
Round 0: fluxxdog wins initiative!
Round 0: fluxxdog uses the Rain-Doh indigo cup!
You gain 253 hit points
Round 1: fluxxdog casts MIGHTY AXING!
Round 2: cubist bull takes 763 damage.
Round 2: fluxxdog wins the fight!
You gain 493 Meat
You gain 27 Strengthliness
You gain 8 Mysteriousness
You gain 11 Sarcasm
 > Now turn your head and cough...
 > Raiding the fridge...
 > Getting pumped up...
 > Pumpkin bombs are ready to throw!
 > You need 123 thin black candles. You can farm at the Giant's Castle.
 > You're running low on milk of magnesium. Might want to be a sauceror.
 > Ready for battle!

[4052] Haunted Gallery
Encounter: guy with a pitchfork, and his wife
Round 0: fluxxdog wins initiative!
Round 0: fluxxdog uses the Rain-Doh indigo cup!
You gain 253 hit points
Round 1: fluxxdog casts MIGHTY AXING!
Round 2: guy with a pitchfork, and his wife takes 761 damage.
Round 2: fluxxdog wins the fight!
You gain 253 Meat
You acquire an item: pitchfork
You gain 31 Beefiness
You gain 9 Wizardliness
You gain 8 Sarcasm
 > Now turn your head and cough...
 > Raiding the fridge...
 > Getting pumped up...
 > Pumpkin bombs are ready to throw!
 > You need 123 thin black candles. You can farm at the Giant's Castle.
 > You're running low on milk of magnesium. Might want to be a sauceror.
 > Ready for battle!

[4053] Haunted Gallery
Encounter: empty suit of armor
Round 0: fluxxdog wins initiative!
Round 0: fluxxdog uses the Rain-Doh indigo cup!
You gain 253 hit points
Round 1: fluxxdog casts MIGHTY AXING!
Round 2: empty suit of armor takes 791 damage.
Round 2: fluxxdog wins the fight!
You gain 27 Strengthliness
You gain 16 Magicalness
You gain 6 Smarm
 > Now turn your head and cough...
 > Raiding the fridge...
 > Getting pumped up...
 > Pumpkin bombs are ready to throw!
 > You need 123 thin black candles. You can farm at the Giant's Castle.
 > You're running low on milk of magnesium. Might want to be a sauceror.
 > Ready for battle!

[4054] Haunted Gallery
Encounter: Louvre It or Leave It 
 > Now turn your head and cough...
 > Raiding the fridge...
 > Getting pumped up...
 > Pumpkin bombs are ready to throw!
 > You need 123 thin black candles. You can farm at the Giant's Castle.
 > You're running low on milk of magnesium. Might want to be a sauceror.
 > Ready for battle!

[4054] Haunted Gallery
Encounter: Louvre It or Leave It 
 > Now turn your head and cough...
 > Raiding the fridge...
 > Getting pumped up...
 > Pumpkin bombs are ready to throw!
 > You need 123 thin black candles. You can farm at the Giant's Castle.
 > You're running low on milk of magnesium. Might want to be a sauceror.
 > Ready for battle!
<repeat until abort>
You can see it doesn't have any trouble with the other choice adventure, picking option 3.
 

Veracity

Developer
Staff member
How are you adventuring?

- GUI?
- CLI command? (show it to me)
- ASH script? (show it to me)

Do you have a CCS? (let's see it)
Using a consult script? (which one?)
 

Fluxxdog

Active member
Gah! Forgot about the Louvre. I'll show you the script that handles it:
Code:
buffer run_choice(buffer input){ [COLOR="#0000FF"]<==input is visit_url(to_url(location))[/COLOR]
	while(contains_text(input,"action=choice.php")){
		setupchoice(my_location());
		int ch_adv=to_int(excise(input,"whichchoice value=","><"));
		boolean check(int adnum,int chnum){
			return ch_adv==adnum && prop_count("choiceAdventure"+ch_adv)==chnum;}
		switch(ch_adv){
		case 0: bad_exit_print("Error finding choice adventure number!"); break;
		[COLOR="#FF0000"][B]case 91: cli_execute("choice-goal"); set_length(input,0); break; //Louvre[/B][/COLOR]
		//All past here need special handling or may default
		case 187: if(check(187,1)) input=beerpong(input); //Play insult beer pong?
		default:
			if(prop_count("choiceAdventure"+ch_adv)<1) full_stop("Full stop for manual action!");
			else {
				debug_print("Choice adventure "+ch_adv+" with with choice number "+prop_count("choiceAdventure"+ch_adv));
				input=visit_url("choice.php?whichchoice="+ch_adv+"&option="+prop_count("choiceAdventure"+ch_adv)+"&pwd");}}
		}
	return input;}
I realized why it constantly loops. cli_execute("choice-goal") fails, it wipes the page buffer clean (otherwise, since cli_execute always returns true/false it would always get caught in the while() loop), and returns it to another script to adventure, and since it never completed the choice to begin with, it repeats it. So it boils down to "Why is cli_execute("choice-goal") failing the first time?" After I manually go through the choice adventure, it works fine after that. The preferences are set to go through to the preselected goal with the goal set to travel to gain mainstat.
And before you ask why have something that handles it like that to begin with, I had a major problem with mafia constantly loading bBS scripts before each and every adventure instead of keeping it memory which would make my old netbook slow to a crawl, sometimes taking up to 2 minutes to spend one adventure because of the complexity of the scripts I use. So to burn 300 turns in a day it could take all day, quite literally. With the setup I scripted, it would only take about one hour to burn those turns. But then, I rarely journeyed in to the Gallery. I decided to go this time because I'm going for the Boris trophy (and my clan has the PLD empty). That's when I noticed this happening.
EDIT: I've changed that line of red code to:
Code:
		case 91: cli_execute("choice-goal");
			if(!last_encounter().contains_text("(")) abort("choice-goal failed!");
			else set_length(input,0);
			break; //Louvre
So tomorrow, I'll hit the gallery and see if it aborts. If it does, choice-goal just isn't firing for some reason.
 
Last edited:

Veracity

Developer
Staff member
Did you submit a bug report about the "constantly loading bBS scripts before each and every adventure instead of keeping it memory" issue? We are supposed to compile scripts and save the Interpreter and only redo that if the file changes on your disk. In other words, what you described is not how it is supposed to work - and not how it works for other people.

You say "The preferences are set to go through to the preselected goal with the goal set to travel to gain mainstat." Can I see the preferences in question, please, since they will be looked at by choice-goal.

Can you get a debug log of what happens when it encounters the Louvre? I want to see what URLs choice-goal submits.

How, exactly, do you expect choice-goal to return info to you? You modified your code to do this: if(!last_encounter().contains_text("(")). What is last_encounter()? I don't see it in the ASH Runtime Library, so it must be a user-supplied function.
 

Fluxxdog

Active member
I'm about to start up for the day. Answers first:
Did you submit a bug report about the "constantly loading bBS scripts before each and every adventure instead of keeping it memory" issue? We are supposed to compile scripts and save the Interpreter and only redo that if the file changes on your disk. In other words, what you described is not how it is supposed to work - and not how it works for other people.
I had thought that was intended behavior. Because the script could be changed between adventures and be reloaded to have those changes go in to effect. I've broached the subject in this thread. I added a print("Loading scripts"); line to one of my main libraries to test for it. If we see it listed more than once, then it's reloading. That'll be for another time though.
You say "The preferences are set to go through to the preselected goal with the goal set to travel to gain mainstat." Can I see the preferences in question, please, since they will be looked at by choice-goal.
Not a problem.
Code:
> prefref louvre

lastLouvreMap (user, now '24', default '0')
louvreDesiredGoal (user, now '4', default '7')
louvreGoal (user, now '4', default '0')
louvreLayout (user, now '0,97,0,0,0,0,0,0,0,0,0,0,0,0,0,102,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0', default '')
louvreOverride (user, now '', default '')

> get choiceAdventure91

1
Can you get a debug log of what happens when it encounters the Louvre? I want to see what URLs choice-goal submits.
I'll do that today, starting the log when I first start my farming script.
How, exactly, do you expect choice-goal to return info to you? You modified your code to do this: if(!last_encounter().contains_text("(")). What is last_encounter()? I don't see it in the ASH Runtime Library, so it must be a user-supplied function.
last_encounter() simply retursn the lastEncounter property as a string. When going through the Louvre, lastEncounter stores the name of the choice before you've reached your goal, in this case, the adventure for me to get Muscle is "Louvre It or Leave It (Sunday Afternoon on the Island of La Grande Jatte)". When choice-goal fails, however, lastEncounter simply has "Louvre It or Leave It". A simple check for a lack of a parentheses should be enough to detect the failure.
 

Veracity

Developer
Staff member
I had thought that was intended behavior. Because the script could be changed between adventures and be reloaded to have those changes go in to effect. I've broached the subject in this thread.
It is expected behavior to ask the OS if the "last modified" date of the script is different from the last time we checked and reload it if the script has changed. But, we don't reload if the OS says the script has not changed.

Unless you have a very strange OS, getting the "last modified" date of a file which has recently been looked at should take milliseconds and no disk access.

I added a print("Loading scripts"); line to one of my main libraries to test for it. If we see it listed more than once, then it's reloading. That'll be for another time though.
If we see it more than once, it means it is executing the top-level commands in the libraries each time the main script executes again. That is expected; libraries are allowed to initialize top-level data based on changing global state. It does not mean that KoLmafia is going to the disk and re-reading the file and recompiling and making a new interpreter.

Edit: I verified this. I made the following scripts:

main1.ash:
Code:
import <lib1.ash>;
import <lib2.ash>;

print( "executing main" );
lib1.ash:
Code:
print( "loading lib1" );
lib2.ash:
Code:
print( "loading lib2" );
I also stuck a debug print in the place where we actually load an ASH script and make the interpreter.

The first time I execute main1.ash, I see this on my terminal window:

Creating new interpreter for /Users/brianna/Library/Application Support/KoLmafia/scripts/test/main1.ash

and in the gCLI, I see:

> main1

loading lib1
loading lib2
executing main
every time I execute it. I only get the "Creating new interpreter" once, but, as you can see, it executes top level commands in all libraries every time.

It strikes me that this could be why it is slow for you: perhaps your libraries create a lot of global data which really is static; big maps of items, and what have you. Currently, there is no way to initialize such data exactly once in a particular ASH Interpreter. Perhaps there should be. But, that is a topic for discussion over in "Scripting Discussion"
 
Last edited:

Fluxxdog

Active member
Fair waring: the attached files are zip files with a 7zip archive inside them. Don't know why 7zip isn't allowed, but gotta make do.
EDIT: Removed attachments and re-uploaded in another post

Alright, here's the debug log. Had to stop and reset a few times because of how huge they were and STILL had to compress because of the size (choice-goal-fail.zip). The log is roughly 68 MB in size uncompressed. Here also is the CLI of how I handled the issue afterwards:
Code:
[5224] Haunted Gallery
Encounter: Louvre It or Leave It
choiceAdventure89 => 1
choice-goal failed! <==That was printed out from my script

> choice 1

You aren't in a choice adventure.
That isn't one of your choices.
Encounter: Louvre It or Leave It
Encounter: Louvre It or Leave It (Escher: Relativity)
Encounter: Louvre It or Leave It (Munch: The Scream)
Encounter: Louvre It or Leave It (Seurat: Sunday Afternoon on the Island of La Grande Jatte)
You gain 330 Fortitude
You gain a Muscle point!

> get lastEncounter

Louvre It or Leave It (Seurat: Sunday Afternoon on the Island of La Grande Jatte)
I should have made a debug for that in retrospect....

As far as the scripts being reloaded time and again, I made a second debug log using mafia's Adventure interface for 3 adventures (3adv.zip). I may not be reading it right, you'd know better than I would, but it looks like every adventure, it rebuilds everything from scratch. And I assure you I did not touch the scripts involved myself.
 
Last edited:

Veracity

Developer
Staff member
Fair waring: the attached files are zip files with a 7zip archive inside them. Don't know why 7zip isn't allowed, but gotta make do.
I have no idea what 7zip is. It appears to be a Windows program with its own non-standard file format. Please give me a .zip file. Thanks.

As far as the scripts being reloaded time and again, I made a second debug log using mafia's Adventure interface for 3 adventures (3adv.zip). I may not be reading it right, you'd know better than I would, but it looks like every adventure, it rebuilds everything from scratch. And I assure you I did not touch the scripts involved myself.
As I mentioned in my note right above yours (edited, admittedly), that is expected behavior. Your print says nothing about whether the ASH file is reloaded from disk and recompiled; it merely says that the top-level commands in each file are executed anew each time.

That is expected behavior.
 

Veracity

Developer
Staff member
OK. I finally have a way to investigate this.

lv.ash:
Code:
boolean found_choice( buffer buf )
{
    if ( !buf.contains_text( "action=choice.php" ) )
	return false;
    return true;
}

void main( int tries )
{
    string gallery = $location[ gallery ].to_url();
    for i from 1 to tries {
	cli_execute( "mood execute" );
	buffer buf = visit_url( gallery );
	if ( found_choice( buf ) ) {
	    if ( buf.contains_text( "whichchoice=91" ) ) {
		print( "found louvre!" );
		cli_execute("choice-goal");
		break;
	    }
	    print( "found choice!" );
	    cli_execute("choice 1");
	} else {
	    run_combat();
	}
	restore_hp( 0 );
    }
}
yields this:

> lv 5
...
Casting The Sonata of Sneakiness 1 times...
You acquire an effect: The Sonata of Sneakiness (duration: 20 Adventures)
The Sonata of Sneakiness was successfully cast.
Casting Fat Leon's Phat Loot Lyric 1 times...
You acquire an effect: Fat Leon's Phat Loot Lyric (duration: 20 Adventures)
Fat Leon's Phat Loot Lyric was successfully cast.
Mood swing complete.

[339005] Haunted Gallery
Encounter: Out in the Garden
found choice!
You aren't in a choice adventure.
That isn't one of your choices.
Encounter: Out in the Garden
Encounter: Knight (Snake)
Strategy: brianna [default]
Round 0: Brianna wins initiative!
Round 1: Brianna executes a macro!
Round 1: Brianna tries to steal an item!
Round 2: Brianna attacks!
Round 3: knight (snake) takes 1147 damage.
Round 3: Brianna wins the fight!
You gain 8 Fortitude
You gain 5 Magicalness
You gain 17 Smarm
 

Fluxxdog

Active member
I have no idea what 7zip is. It appears to be a Windows program with its own non-standard file format. Please give me a .zip file. Thanks.
Oh for Hastur's love, not this again... Reuploaded because... no, that's a rant for somewhere else. I will simply suggest 7zip.org and leave it at that.
As I mentioned in my note right above yours (edited, admittedly), that is expected behavior. Your print says nothing about whether the ASH file is reloaded from disk and recompiled; it merely says that the top-level commands in each file are executed anew each time.

That is expected behavior.
It strikes me that this could be why it is slow for you: perhaps your libraries create a lot of global data which really is static; big maps of items, and what have you. Currently, there is no way to initialize such data exactly once in a particular ASH Interpreter. Perhaps there should be. But, that is a topic for discussion over in "Scripting Discussion"
Considering two records I have loaded up each time:
Code:
record breeding{
	string[familiar]mimics; //The critter mimics another familiar
	//float familiar? used for scoring since maximizer only considers calculable stuff
	boolean[element]flavor; //slime element infers tuned damage, i.e. Knob Goblin Organ Grinder
	string special_gear; //Calls a function defined in kennel.ash
	string crown_buzz; //effect in the crown, similar to maximize
	string crown_act; //action in the crown, similar to maximize
	boolean[item]crown_drop; //items dropped while in crown
	}; breeding[familiar]Pedigree; file_to_map("pedigree.txt",Pedigree);

record mapquest{
	boolean legacy; //if discontinued, then true
	item Semirare; //Semirare treasure
	monster Semimon; //Semirare monster
	item Ultrarare; //Ultrarare treasure
	monster Ultramon; //Ultrarare monster
	int min_prime; //minimum prime stat needed
	boolean rod_needed; //need turtling rod
	boolean special_turtle; //need Grinning or Syncopated
	item turtle_prize; //which turtle you get
	string demonName; //which demon name comes from here (uses mafia property name such as demonName2)
	string fistSkill; //which areas have scrolls of the Surprising Fist (uses mafia property name such as fistTeachingsSlums)
	boolean mayflyboost; //Special effect from mayfly swarm
	}; mapquest[location]Atlas; file_to_map("atlas.txt",Atlas);
...and I have an entry for each location and familiar. Explains quite a bit more.
 

Attachments

  • 3adv.zip
    786.2 KB · Views: 29
  • choice-goal-fail.zip
    1.5 MB · Views: 37

Veracity

Developer
Staff member
Oh for Hastur's love, not this again... Reuploaded because... no, that's a rant for somewhere else. I will simply suggest 7zip.org and leave it at that.
Are you serious? You are annoyed with me? You have GOT to be joking.

I had never heard of 7zip before today. After you uploaded the file - and BEFORE I asked you to re-upload it - I googled it, went to 7zip.org and saw that it was a Windows-only program. On that page, they had several "unofficial p7zip packages" for OS X. I tried to get two of them. The first one was a bad link; there was nothing there any more. The second one sent me to a page with a real app on it. I downloaded it. I started up the downloaded-from-random-internet-location application and did what it told me to do. I dragged your 7zip file onto it. It gave me an error.

I deleted the piece of shit app and decided not to bother searching for Yet Another App to try to unpack your non-standard archive. I politely asked you to give me a standard format archive.

And you just got irritated with me and threatened a "rant".

You have seriously pissed me off.

Why the fuck should I be required to download an Internet application onto my computer, with all the risks inherent in doing such, just so I can open an archive type that I have never seen before - and hopefully will never see again? And you have the gall to get irritated with ME?

Fuck off. I will solve your choice problem, and then just ignore you. Sheesh.
 

Fluxxdog

Active member
Are you serious? You are annoyed with me?
No, just hearing the same stuff from so few people. I fell in love with 7zip when I was running a Debian setup and was introduced to it because it was open source. I just tend to type what I think. Sorry.
 

Veracity

Developer
Staff member
Working test script:
Code:
void main( int tries )
{
    string gallery = $location[ gallery ].to_url();
    for i from 1 to tries {
	cli_execute( "mood execute" );
	buffer buf = visit_url( gallery );
	if ( buf.contains_text( "action=choice.php" ) ) {
	    if ( buf.contains_text( "value=91" ) ) {
		print( "found louvre!" );
		cli_execute("choice-goal");
		break;
	    }
	    print( "found choice!" );
	    cli_execute("choice 1");
	} else {
	    run_combat();
	}
	restore_hp( 0 );
    }
}

Revision 10764
 
Last edited:
Top