Nemesis quest script

Winterbay

Active member
It appears that that is what my line 1153 is saying.

Thank you for the URLs you posted, but the one I needed is missing (the one that is submitted when you hit the "Fight!" button to make the fight happen in the Barracks).

I didn't notice any "Fight!"-buttons in the Barracks. I either went directly from clicking on something to search or got an attack while trying to sneak in.
 

slyz

Developer
I guess I need to see the HTML of the pages myself to be able to test things then. Regarding the 'Fight!' button, you can see what I mean on the kolwiki page of any of the Barrack locations.

I uploaded the latest local copy to the first post, with a few tweaks.
 

Winterbay

Active member
I guess I need to see the HTML of the pages myself to be able to test things then. Regarding the 'Fight!' button, you can see what I mean on the kolwiki page of any of the Barrack locations.

I uploaded the latest local copy to the first post, with a few tweaks.

Hmm... I never saw that button and I got several fights... I wonder if Mafia silently managed to click it for me or if something else was going on...
 

slyz

Developer
Maybe that explains it then. Oh, and I just now realized that what I was doing to view the HTML of pages actually changed the HTML... (I was using HTML Tidy in notepad++). I removed extra quotes in the function that parses the HTML to find out which choice adventure you are on - get_current_adv().

I'm ascending AT now, but if anyone else wants to give it a twirl before I do, please post what happens after redownloading the script.
 

slyz

Developer
I finally managed to get the AT part right.
  • There was no need to submit anything to start a fight with Mariachis found in the Barracks: simply using run_combat() instead of trying to use the 'Fight' button worked.
  • If, like me, you paste the HTML of a page in notepad++ and use TextFX HTML Tidy, know that it will add quotes around values. The RegEx for parsing which choice adventure you are currently in now works.
  • I tweaked the logic a little bit. Each room in the Barrack has 3 locations: one with an item, one with a Mariachi, and a special one (with a hint or a key). The script visits locations in a room until the special location is found. If two locations have been visited, the third one is deduced.
  • According to the KoLWiki: "Four of the keys can be obtained through exploring The Island Barracks, but one key must be acquired by pickpocketing mariachis.". I added logic for this, tracking the number of keys obtained in special locations, but it is untested.
  • If you have a Bandersnatch and Ode to Booze permed, the script will use them. Apparently, when running combats with visit_url() and run_combat(), Bander runaways aren't tracked by Mafia, so the script will keep casting Ode even if you can't get any more free runaways.

It was fun scripting this. I'm genuinely happy with my naviguate_barrack() function =)

It did all the nessecary steps and then swam back to shore, followed by 1 failed attempt at a correct solution and 5 where it went 1 step and then swam back. No idea what was up with that.
This happened to me too. I was counting on the return value of cli_execute() to check if the maze was solved successfully, but apparently it doesn't always work. I'm going to execute "volcano solve" just once and let the user deal with the result (which is not hard with the 'Solve' button).

I'll probably manage a Pastamancer ascension before ascending DB for Crimbo, I'll add Mr Purple's code.
 
Last edited:

Fluxxdog

Active member
This happened to me too. I was counting on the return value of cli_execute() to check if the maze was solved successfully, but apparently it doesn't always work. I'm going to execute "volcano solve" just once and let the user deal with the result (which is not hard with the 'Solve' button).
Yeah, there's no way to really use information from cli_execute. It only returns true/false. Learned that the hard way in my early scripting lessons. When I tried the Volcano puzzle in my own scripts, it kept trying to solve the volcano over and over. This is what it current looks like:
PHP:
while(!possess_item("Seeger's Unstoppable Banjo")){
	while(last_encounter()!="The Spirit of New Wave"){
		go_hunting_in("The Nemesis' Lair");}}
equip($item[Shagadelic Disco Banjo]);
	# cli_execute( "volcano solve" ))
	xprint("Prepare yourself...","green",1);
 

slyz

Developer
Yeah, there's no way to really use information from cli_execute. It only returns true/false.
I thought the return value was false if the command ended with Mafia being in a state other than CONTINUE_STATE, but apparently the return value also depends on KoLmafia.hadPendingState (which I don't know much about).

I'm not familiar enough with the code to find out what is set when in the Volcano Maze manager, or even earlier in the execution of an ASH script. I was counting on the return value being false only when no solution was found (lines 686-690 of VolcanoMazeManager.java), but I guess something else is setting KoLmafia.continuationState or KoLmafia.hadPendingState.

It's not really important though: if that one scripted tentative doesn't work, it's still really easy to get through the Maze manually in the Relay Browser.
 

T_E

Member
Hello~

I'm trying to run this script to finish the DB version of the Nemesis quest. I'm at the Volcano Lair, trying to learn the dance moves, and receive this message after one battle:
Conditions not satisfied after 1 adventure.
The Rave Moves were not learned.
Problem occured while opening the Nemesis Lair, exiting...

I did do a few adventures before finding and installing your script- is this the cause of the error?

Regardless- this looks like an awesome script that I'll be happy to try next time around, as I tend to to the Nemesis quest at the end of each run (and it's getting a bit monotonous). =)
 

slyz

Developer
It's strange that learn_rave_skills() returns false if adventure() returns false like this... I'll try adding a trap for adventure(). I already mess with a lot of settings which aren't reset if the script doesn't stop by itself, I'd rather avoid changing the autoSetConditions property too.

I uploaded the new version in the first post.
 
Last edited:

Theraze

Active member
Most of Rinn's scripts, it manually runs a conditions clear before it sets new conditions. As I'm adding new conditions to update them, I'm continuing this... The only time you'd really want to keep manual conditions that were active before you started the script would be if they were familiar drop, meat, stat, or level. As most conditions are item conditions though, this has been a major thorn in my scripted-adventuring side in the past. :)
 

slyz

Developer
I added the "conditions clear" and removed the traps for adventure(), since I'm not sure how trapping the return value would play with restoring problems, and I can't test right now. If Mafia can't restore for some reason, and refuses to adventure, trapping the return value could start an infinite loop, I guess, instead of making the script exit cleanly.
 

Grotfang

Developer
This happened to me too. I was counting on the return value of cli_execute() to check if the maze was solved successfully, but apparently it doesn't always work. I'm going to execute "volcano solve" just once and let the user deal with the result (which is not hard with the 'Solve' button).

Assuming this script leads into the volcano maze, why not include the code from my lava.ash script? It wouldn't take much to get the function to return a boolean value and you could fall back on "cli_execute( "volcano solve" )" if it returns false. Doesn't handle new mazes... but are those likely?

It's there if you need it.
 

slyz

Developer
I had completely forgotten about it since Veracity implemented the solver in Mafia. Since I'm not planning on scripting the last fight with the Nemesis, I don't think I'll simply let the user finish up through the Relay Browser.
 

Winterbay

Active member
This post has been edited. In order to keep the following posts understandable it has been recreated (sort of).

It was regarding having the paper strips in your inventory when the script tried to get "+8 any paper strip" from the cave which made Mafia continue to adventure until aborted because the strips were already there.
 
Last edited:

slyz

Developer
The Epic hats aren't quest items, so you might have one from a previous ascension. To recap: you had the paper strips, but hadn't clicked on the last cave door?

Before farming for the paper strips, getPaperStripsPassword() is called. It will not try to find the password if lastPaperStripReset wasn't set to your current ascension. lastPaperStripReset is set to your last ascension when Mafia successfully identifies all the paper strips (this happens when you use the "nemesis strips" CLI command).

I wasn't accounting for your case, so I added a cli_execute( "nemesis strips" ); at the beginning of getPaperStripsPassword().

I'm working on the Pastamancer unlock now, this change will go in the next update. If you aren't past that point yet, just type "nemesis strips" in the gCLI before re-launching the script.

Thanks for exploring edge cases like this =)
 
Top