Wrldwzrd89's sleep_unlock.ash: Sleeping to unlock hot dog content

Really simple script, this. It won't work if you don't have an awful poetry journal - but that's why I'm posting it here, for improvement suggestions. It works just fine if you DO have one. All it does is uses an awful poetry journal once then rests at your campsite once, over and over again until running out of adventures - which is supposedly the way one of the hot dogs is unlocked.

History
V1.2.0 (July 7, 2013): Don't loop infinitely if resting fails. Upgrade multi-resting method to be more reliable.
V1.1.0 (July 6, 2013): Functionality enhanced thanks to slyz. Now stops once the goal is achieved.
V1.0.0 (July 5, 2013): Script started.
 
Last edited:

heeheehee

Developer
Staff member
Casting your class trivial skill seems like the most reliable way to allow repeated resting.

i.e. use_skill(1, my_class().to_int() * 1000)? Of course, that won't work in any of the avatar paths (Mighty Axing, Infectious Bite, and Curdle aren't useable outside of combat).
 

slyz

Developer
Here is what I came up with. I haven't found the dream of a dog yet, but I least I have a quick way to burn my turns now.
PHP:
string page;
string REST_URL = "campground.php?action=rest";
string ROMANTIC_COUNTER_END_LABEL = "Romantic Monster window end";

while ( my_adventures() > 0 && !page.contains_text( "dream of a dog" ) )
{
	if ( ROMANTIC_COUNTER_END_LABEL.get_counters( 0, 0 ).length() > 0 )
	{
		adv1( $location[ The Haunted Pantry ], -1, "" );
	}

	if ( my_mp() > my_maxmp() * 0.95 )
	{
		cli_execute( "burn *" );
	}

	page = REST_URL.visit_url();
}
 
V1.2.0 released with a few fixes and upgrades.
First of all, V1.1.0 had an infinite loop bug that reared its ugly head if mana burning failed. This is fixed in V1.2.0.
Secondly, the mana burning method used wasn't all that reliable: KoLmafia would eventually refuse to burn mana, triggering the infinite loop problem. This too is fixed, by casting the trivial skill if available, falling back to an awful poetry journal if that fails, and aborting if both fail.
 

Bale

Minion
If I get the dog or have another dream I want to actually see the message livening up my output, so I created this amusing variant:

Code:
string page;
string REST_URL = "campground.php?action=rest";
string ROMANTIC_COUNTER_END_LABEL = "Romantic Monster window end";

void dream(string rest) {
	int a = index_of(rest, '<table  width=95%  cellspacing=0');
	int b = index_of(rest, '<table  width=95%  cellspacing=0 cellpadding=0><tr><td style="color: white;" align=center bgcolor=blue><b>Your Campsite');
	if(a >= 0) {
		if(b < 0) b = length(rest);
		rest = substring(rest, a, b);
		if(length(rest) > 709)
			print_html(rest);
	} else print("Resting failed?", "red");
}

while ( my_adventures() > 0 && !page.contains_text( "dream of a dog" ) )
{
	if ( ROMANTIC_COUNTER_END_LABEL.get_counters( 0, 0 ).length() > 0 )
	{
		adv1( $location[ The Haunted Pantry ], -1, "" );
	}
	cli_execute( "burn *" );
	if(my_mp() >= my_maxmp())
		switch(my_class()) {
		case $class[Seal Clubber]:
			use_skill(1, $skill[Seal Clubbing Frenzy]);
			break;
		case $class[Turtle Tamer]:
			use_skill(1, $skill[Patience of the Tortoise]);
			break;
		case $class[Pastamancer]:
			use_skill(1, $skill[Manicotti Meditation]);
			break;
		case $class[Sauceror]:
			use_skill(1, $skill[Sauce Contemplation]);
			break;
		case $class[Disco Bandit]:
			use_skill(1, $skill[Disco Aerobics]);
			break;
		case $class[Accordion Thief]:
			use_skill(1, $skill[Moxie of the Mariachi]);
			break;
		case $class[Avatar of Boris]:
			use_skill(1, $skill[Laugh it Off]);
			break;
		case $class[Zombie Master]:
		case $class[Avatar of Jarlsberg]:
		default:
			if ( item_amount($item[awful poetry journal]) > 0 )
				use(1, $item[awful poetry journal]);
			else
				abort("Your class lacks a good mana burning skill and an awful poetry journal.");
		}
	try page = REST_URL.visit_url();
	finally dream(page);
}

Note that I slightly improved on your mp expenditure code as well.
 
Last edited:

slyz

Developer
The whole point of using visit_url() was to avoid using a server hit for the trivial skill hack.
 

lostcalpolydude

Developer
Staff member
The whole point of using visit_url() was to avoid using a server hit for the trivial skill hack.

That does nothing about KoL preventing you from resting if you are at full HP/MP. If you try to burn MP and you're still full, you have no choice but to waste a server hit.
 

slyz

Developer
Oh, I thought it was a purely a Mafia thing.

Now I wonder why casting your class trivial fools KoL into allowing you to rest. It doesn't use any MP, right?

EDIT: only the combat trivials cost 0 MP...
 

Bale

Minion
Here's a variant which is useful for finding Speakeasy passwords. It will only find one letter at a time, but that's a nice start.

Code:
string page;
string REST_URL = "campground.php?action=rest";
string ROMANTIC_COUNTER_END_LABEL = "Romantic Monster window end";

void dream(string rest) {
	int a = index_of(rest, '<table  width=95%  cellspacing=0');
	int b = index_of(rest, '<table  width=95%  cellspacing=0 cellpadding=0><tr><td style="color: white;" align=center bgcolor=blue><b>Your Campsite');
	if(a >= 0) {
		if(b < 0) b = length(rest);
		rest = substring(rest, a, b);
		rest = rest.replace_string("<p>You lie back in your gauze hammock and rest.", "");
		rest = rest.replace_string("<p>Your Pagoda sends out groovy vibes, making your rest more restful.", "");
		if(length(rest) > 709) {
			print_html(rest);
			print(" ");
		}
	} else print("Resting failed?", "red");
}

#while ( my_adventures() > 0 && !page.contains_text( "dream of a dog" ) )
while ( my_adventures() > 0 && !page.contains_text( "a single letter glows" ) )
{
	if ( ROMANTIC_COUNTER_END_LABEL.get_counters( 0, 0 ).length() > 0 )
	{
		adv1( $location[ The Haunted Pantry ], -1, "" );
	}
	cli_execute( "burn *" );
	if(my_mp() >= my_maxmp())
		switch(my_class()) {
		case $class[Seal Clubber]:
			use_skill(1, $skill[Seal Clubbing Frenzy]);
			break;
		case $class[Turtle Tamer]:
			use_skill(1, $skill[Patience of the Tortoise]);
			break;
		case $class[Pastamancer]:
			use_skill(1, $skill[Manicotti Meditation]);
			break;
		case $class[Sauceror]:
			use_skill(1, $skill[Sauce Contemplation]);
			break;
		case $class[Disco Bandit]:
			use_skill(1, $skill[Disco Aerobics]);
			break;
		case $class[Accordion Thief]:
			use_skill(1, $skill[Moxie of the Mariachi]);
			break;
		case $class[Avatar of Boris]:
			use_skill(1, $skill[Laugh it Off]);
			break;
		case $class[Zombie Master]:
		case $class[Avatar of Jarlsberg]:
		default:
			if ( item_amount($item[awful poetry journal]) > 0 )
				use(1, $item[awful poetry journal]);
			else
				abort("Your class lacks a good mana burning skill and an awful poetry journal.");
		}
	try page = REST_URL.visit_url();
	finally dream(page);
}
 

Andyzer0

New member
Can we get a script for the Detective Skull? I figure we just need to combat until a round says "The dame" and then stop and show that round.
 
Top