CartoucheHunter

ungawa

Member
CartoucheHunter 0.9

This script requires ZLib and CanAdv

This script is designed to adventure in every zone that does not already appear in today's log, and abort if you find a cartouche.
-I recommend wearing The Crown of Ed the Undying, pirate fledges, and maximizing +combat%.
-If the script stops you can re-run the script to have it pick up where it left off.

This script is based on Donavin69's KingdomExplorer 0.4 script.
-With lost's help, I added a break to abort if today's session log contains "Cartouche:"
-Theraze has updated CanAdv, so it has been added back in version 0.6 to check if a zone is available before trying to adventure there
-I updated the list of zones that are blacklisted by this script. Let me know if there are additional zones that you think should be blacklisted. See the end of this post for the current list of skipped zones (clan dungeons, etc)

Potential improvements:
-Abort if crown is not equipped

Let me know if you have any coding/functionality suggestions. Since this is my first shared script here, I'm sure it's a bit kludgey.

To install this script copy-paste the following line into the CLI and press return. Run by typing CartoucheHunter into the CLI.

svn checkout https://svn.code.sf.net/p/cartouchehunter/svn/

Versions:
0.1 - Initial Release
0.2 - Updated list of skipped zones
0.4 - Added ability to install by SVN
0.5 - Updated to only try to adventure in adventure.php locations
0.6 - Added CanAdv check, added dependencies.txt to automatically install zlib and CanAdv
0.7 - Script will try to adventure again in the same zone if the previous adventure was a noncombat, up to 3 times
0.8 - Fixed a bug introduced in version 0.7 that broke the function to abort when after finding the cartouche
0.9 - Updated zone blacklist to include Frat House In Disguise to avoid drunkenness noncombat

Zones currently skipped:
Code:
static {
	forbidden[ $location[Richard's Hobo Mysticality] ] = TRUE;
	forbidden[ $location[Richard's Hobo Moxie] ] = TRUE;
	forbidden[ $location[Richard's Hobo Muscle] ] = TRUE;
	forbidden[ $location[A Maze of Sewer Tunnels] ] = TRUE;
	forbidden[ $location[Hobopolis Town Square] ] = TRUE;
	forbidden[ $location[Burnbarrel Blvd.] ] = TRUE;
	forbidden[ $location[Exposure Esplanade] ] = TRUE;
	forbidden[ $location[The Heap] ] = TRUE;
	forbidden[ $location[The Ancient Hobo Burial Ground] ] = TRUE;
	forbidden[ $location[The Purple Light District] ] = TRUE;
	forbidden[ $location[The Slime Tube] ] = TRUE;
	forbidden[ $location[Dreadsylvanian Castle] ] = TRUE;
	forbidden[ $location[Dreadsylvanian Village] ] = TRUE;
	forbidden[ $location[Dreadsylvanian Woods] ] = TRUE;
	forbidden[ $location[The Prince's Restroom] ] = TRUE;
	forbidden[ $location[The Prince's Dance Floor] ] = TRUE;
	forbidden[ $location[The Prince's Kitchen] ] = TRUE;
	forbidden[ $location[The Prince's Balcony] ] = TRUE;
	forbidden[ $location[The Prince's Lounge] ] = TRUE;
	forbidden[ $location[The Prince's Canapes Table] ] = TRUE;
	forbidden[ $location[none] ] = TRUE;
	forbidden[ $location[Pump Up Moxie] ] = TRUE;
	forbidden[ $location[Pump Up Muscle] ] = TRUE;
	forbidden[ $location[Pump Up Mysticality] ] = TRUE;
	forbidden[ $location[The Lower Chambers] ] = TRUE;
	forbidden[ $location[The Daily Dungeon] ] = TRUE;
	forbidden[ $location[The Typical Tavern Cellar] ] = TRUE;
	forbidden[ $location[Fernswarthy's Basement] ] = TRUE;
	forbidden[ $location[The Shore, Inc. Travel Agency] ] = TRUE;
	forbidden[ $location[Summoning Chamber] ] = TRUE;
	forbidden[ $location[Goat Party] ] = TRUE;
	forbidden[ $location[Pirate Party] ] = TRUE;
	forbidden[ $location[Lemon Party] ] = TRUE;
	forbidden[ $location[The Barrel Full of Barrels] ] = TRUE;
	forbidden[ $location[Hippy Camp] ] = TRUE;
	forbidden[ $location[Hippy Camp In Disguise] ] = TRUE;
	forbidden[ $location[Dwarven Factory Warehouse] ] = TRUE;  //This line and above were already excluded by KingdomExplorer
	forbidden[ $location[The Haunted Bedroom] ] = TRUE;  //looting the nightstand was confusing the script
	forbidden[ $location[A Massive Ziggurat] ] = TRUE;  //no combat
	forbidden[ $location[The Primordial Soup] ] = TRUE;  //"wastes" part of an empty agua bottle if the player has one in inventory
	forbidden[ $location[The Jungles of Ancient Loathing] ] = TRUE;  //"wastes" part of an empty agua bottle if the player has one in inventory
	forbidden[ $location[Seaside Megalopolis] ] = TRUE;  //"wastes" part of an empty agua bottle if the player has one in inventory
	forbidden[ $location[The Mansion of Dr. Weirdeaux] ] = TRUE;  //potential for difficult combat that could cause the script to abort
	forbidden[ $location[The Fun-Guy Mansion] ] = TRUE;  //potential for difficult combat that could cause the script to abort
	forbidden[ $location[The Oasis] ] = TRUE; //spending one turn will not get you a combat
	forbidden[ $location[The Copperhead Club] ] = TRUE;  //avoid the intrinsic poison
	forbidden[ $location[The Obligatory Pirate's Cove] ] = TRUE;  //script aborts if you try to adventure here with pirate disguise
	forbidden[ $location[The Limerick Dungeon] ] = TRUE;  //no combats
	forbidden[ $location[The Roulette Tables] ] = TRUE; //no combats
	forbidden[ $location[The Poker Room] ] = TRUE; //no combats
	forbidden[ $location[An Incredibly Strange Place (Bad Trip)] ] = TRUE;  //avoid using an astral mushroom
	forbidden[ $location[An Incredibly Strange Place (Mediocre Trip)] ] = TRUE; //avoid using an astral mushroom
	forbidden[ $location[An Incredibly Strange Place (Great Trip)] ] = TRUE; //avoid using an astral mushroom
	forbidden[ $location[Frat House In Disguise] ] = TRUE;
}
 
Last edited:

ungawa

Member
With digitrev's help, I was able to explain away all of the issues I had with CanAdv. Technically, I could add it back in to remove the flashing red on the side panel when it tries inaccessible zones, but is it really hurting anything to leave it out? I guess it's a few extra server hits...

Oasis/Desert/pyramid/cellar were all skipped because CanAdv looks for the regular diary and I did an Ed run, so the diary has a different name.
Spring Break Beach was skipped because I used the item before the pref "sleazeAirportAlways" was added, so it was still false.
The spookyraven 3rd floor was skipped because the pref "questM17Babies=unstarted", and CanAdv checks for "started".
 

lostcalpolydude

Developer
Staff member
My guess is that only adventure.php locations need to be checked, which can be checked with to_url( location ).index_of( "adventure.php" ) == 0.
 

Bale

Minion
To install this script copy-paste the following line into the CLI and press return. Run by typing CartoucheHunter into the CLI.

svn checkout https://svn.code.sf.net/p/cartouchehunter/svn/

Do you want me to add this to the Script Manger? If it is no longer relevant once the puzzle is solved I could always remove it at that hypothetical later date.
 

ungawa

Member
My guess is that only adventure.php locations need to be checked, which can be checked with to_url( location ).index_of( "adventure.php" ) == 0.

Thanks, Lost. That worked well and helps make it a little more elegant.

Do you want me to add this to the Script Manger? If it is no longer relevant once the puzzle is solved I could always remove it at that hypothetical later date.

Go right ahead, thanks.
 

ungawa

Member
Anyone have a good idea how I can check if the previous adventure was a combat or noncombat? I'd like to try a zone a few times until I get a combat.
 

ungawa

Member
I added a function to re-adventure in a zone if the player didn't win a combat on the previous adventure. It checks by seeing if the "LastAdvTxt()" (from post 11 in the thread heeheehee linked above) contains "wins the fight!".
This will re-adventure if the previous adventure was a noncombat or if the player lost.
It is limited to a max of 3 adv, so hopefully it won't get anyone into trouble, but let me know if it's burning multiple turns in places you don't expect.
 
Last edited:

Theraze

Active member
Might want to use WINWINWIN as your win check instead, since that should be found in any successful fight regardless of weird text manglers... or, y'know, haiku dungeon. Where text mangling is just part of how it works for everyone.
 

ungawa

Member
Hm, WINWINWIN doesn't appear anywhere in my log file. My understanding of the LastAdvTxt() function is that it makes a string from the log file, so wouldn't whatever I'm trying to match have to be in the log?
 
Last edited:

Theraze

Active member
Ah, right. If you're parsing the session file, that's right. -_- I was thinking about parsing the run_combat() rather than the session logs. Nevermind. Sorry. :)
 

ungawa

Member
I ran across a bug in version 0.7 that prevented the script from aborting when you found the cartouche. Some nested loops meant that the "break" didn't break all the way out.
Fixed in version 0.8
 

Crowther

Active member
I got over drunk with 200+ turns remaining. . .
Code:
[886] Frat House In Disguise
Encounter: Kegstand!  Kegstand!  Kegstand!
You gain 3 Drunkenness
You gain 20 Fortitude
I also noticed that my bowling balls are being wasted at The Hidden Bowling Alley. For now I've blacklisted those locations in my copy.
 
Top