slow execution of script

asturia

Minion
When I use the following script it executes very slowly.
But when I just tell kolmafia by hand to adventure in that location, it goes very fast.
Does anyone has an idea what is causing this?

Code:
import </subscripts/restorehp.ash>;
import </subscripts/snowcone_buff.ash>;
import </subscripts/candyhearts.ash>;
import </subscripts/flower.ash>;
import </subscripts/dobhh.ash>;

void adventures()
{
	if (my_inebriety() < inebriety_limit()+1 )
	{
		if ( my_primestat() == $stat[muscle])
		{
			cli_execute( "outfit meat2");
			use_familiar( $familiar[Ninja Pirate Zombie Robot]);
			if (have_equipped ($item [Mayflower bouquet]) == false)
			{
				if( item_amount( $item[Mayflower bouquet]) > 0)
				{
					equip ($item[Mayflower bouquet]);
				}
			}
		}
		if ( my_primestat() == $stat[moxie])
		{
			cli_execute( "outfit meat");
			use_familiar( $familiar[Attention-deficit demon]);
			if (have_equipped ($item [lucky tam o'shatner]) == false)
			{
				if( item_amount( $item[lucky tam o'shatner]) > 0)
				{
					equip ($item[lucky tam o'shatner]);
				}
			}
		}
		dobhh();
		while( my_adventures() > 0)
		{
			snowcone_buff();
			if ( my_primestat() == $stat[muscle])
			{
				candyhearts();
			}
			flower();
			adventure( 1, $location[giant's castle]);
			restorehp();
		}
	}
}

void main ()
{
	adventures();
}
 

macman104

Member
What are all of the blank imports? Also, you call some functions in your script, however, you don't attach those, so we have no idea what is running in those functions (snowcone_buff, candyhearts, flower and restorehp).
 

asturia

Minion
here are the other functions that I call in the script:
flower.ash
Code:
//consumes the flowers obtained from the mayflower bouquet.

void flower ()
{
	int aantal = item_amount ($item[half-orchid]);
	if(aantal > 0)
	{
		use ( aantal, $item[half-orchid]);
	}

	aantal = item_amount ($item[begpwnia]);
	if(aantal > 0)
	{
		use ( aantal, $item[begpwnia]);
	}
}

void main()
{
	flower();

Candyhearts.ash
Code:
//Summons and eat candy hearts

void candyhearts()
{
	if (have_skill( $skill[Candy Hearts]))
	{
		while ( mp_cost($skill[Candy Hearts]) <=  my_mp())
		{
			use_skill( 1, $skill[Candy Hearts]);
		}
	}
        use ( item_amount($item[lavender candy heart]), $item[lavender candy heart]);
        use ( item_amount($item[pink candy heart]), $item[pink candy heart]);
        use ( item_amount($item[green candy heart]), $item[green candy heart]);
}

void main()
{
	candyhearts();
}


Snowconebuff.ash
Code:
void snowcone_buff()
{
	boolean visitconcertarea = false;
	
	if(( item_amount( $item[red snowcone]) == 0) && ( item_amount( $item[green snowcone]) == 0) && ( have_effect( $effect[red tongue]) == 0) && ( have_effect( $effect[green tongue]) == 0))
        {
            	if( have_effect( $effect[blue tongue]) == 0)
            	{
                    	if(( item_amount( $item[blue snowcone]) > 0) && ( my_adventures() > 20))
                    	{
                        	use ( 1, $item[blue snowcone]);
                    	}
            	}
        }

	if( item_amount( $item[red snowcone]) == 0 && ( have_effect( $effect[red tongue]) == 0))
        {
            	if( have_effect( $effect[green tongue]) == 0)
            	{
                    	if(( item_amount( $item[green snowcone]) > 0) && ( my_adventures() > 20))
                    	{
                        	use ( 1, $item[green snowcone]);
                    	}
            	}
        }

	if( have_effect( $effect[red tongue]) == 0)
        {
            	if(( item_amount( $item[red snowcone]) > 0) && ( my_adventures() > 20))
            	{
                    	use ( 1, $item[red snowcone]);
            	}
        }

	if( item_amount( $item[green snowcone]) == 0 && ( have_effect( $effect[green tongue]) == 0))
        {
		if (visitconcertarea == false)
	        {
		    	cli_execute ( "postwarisland.php?action=concert&pwd&option=3");
			visitconcertarea = true;
		}
        }

}

void main()
{
	snowcone_buff();
}

restorehp.ash
Code:
void restorehp()
{
	if (have_effect($effect[beaten up]) >= 1)
	{
		if (have_skill( $skill[Tongue of the otter]))
		{
	                use_skill( 1, $skill[Tongue of the otter]);
	        }
	        else
	        {
			cli_execute("uneffect Beaten Up");
		}
	}
	if ( my_hp() < my_maxhp()/10)
	{
		use_skill( 1, $skill[cannelloni cocoon]);
	}
	if (have_effect($effect[Cunctatitis]) >= 1)
	{
		cli_execute("uneffect Cunctatitis");
	}
}

void main()
{
	restorehp();
}
 

holatuwol

Developer
[quote author=cankergoyle link=topic=1172.msg5549#msg5549 date=1187272260]
a hint: cutting down the number of rounds you use will help a lot (perhaps exponentially so).
[/quote]

Oh! ... There's an intentional delay to spread out combat hits (since they're a problem from a web server perspective). If you do something like NPZR stasis, expect your KoLmafia sessions to last 3-4 hours.
 

asturia

Minion
[quote author=holatuwol link=topic=1172.msg5554#msg5554 date=1187282839]


Oh! ... There's an intentional delay to spread out combat hits (since they're a problem from a web server perspective). If you do something like NPZR stasis, expect your KoLmafia sessions to last 3-4 hours.
[/quote]
Except I'm not using my NPZR, I'm using a ADD as my familiar, so this shouldn't happen.
But I've got an idea what's causing it, I've added a new script a few days ago, and I think that is the cause for the slowdown.
Let me try tomorrow and I will know for sure if that is the reason or not.
 

asturia

Minion
okay, I have made some tests today.
here are the results:

  • [li]spending all off my adventures with a script: very slow, 1 adventure done per minute.[/li]
    [li]spending my adventures in the main windows of kolmafia: 10 adventures done per minute or so.[/li]
This all in the same location: giant's castle.
Hola, you said it was due to a delay thing you introduced, but why is it then faster if you use the main window of kolmafia to adventure?
 

asturia

Minion
some more tests are done now.
It seems that 1 of my scripts is slowing done everything.
Testing at the moment to see which one.

I've found the problem:
Code:
	boolean visitconcertarea = false;
        if( item_amount( $item[green snowcone]) == 0 && ( have_effect( $effect[green tongue]) == 0))
        {
		if (visitconcertarea == false)
	        {
		    	cli_execute ( "postwarisland.php?action=concert&pwd&option=3");
			visitconcertarea = true;
		}
        }

I used this to automatically visit the concertarea, but I forgot that I didn't unlock it this ascension.
That was a stupid mistake. Is there a way I can check if it is unlocked or not?
 
Top