newbie- unable to stop adventuring

Nifty Nobu

New member
Alright, I'm a newbie to this scripting, but not to coding. Since I have a slow internet connection, I thought it'd be nice to automate my repetitive, slow farming (but not other things, like mixing drinks, shopping, etc). So I wrote this script and several similar ones, and for a while all was good. It isn't a flawless script, but it does what I want it to most of the time.

Code:
void main()
{
	# Initialize Script
	print("Initiating Script: Adventure at Castle in the Clouds");
	int leave = 0;
	int cntr = 0;
	int prediect = my_adventures() - leave;
	int naplimit = 0;

	# Main Script Loop (stop adventuring when "leave" adventures are left)
	while(my_adventures() > leave)
	{
		# heal if necessary (prefer to use DNP or phonics down, unless beaten up)
		if(my_hp() == 0)
		{
			use(1, $item[tiny house]);
		}
		while( (my_maxhp() - my_hp()) > 40) 
		{
			if(my_mp() > 12)
			{
				if( floor(my_mp() / 12) > floor((my_maxhp() - my_hp())/40) )
					naplimit = floor((my_maxhp() - my_hp())/40);
				else
					naplimit = floor(my_mp() / 12);
				use_skill(naplimit, $skill[Disco Power Nap]);
			}
			else 
			{
				use(1, $item[phonics down]);
			}
		} 
		# end of healing loop

		# adventuring commands
		cntr = cntr + 1;
		print("Adventure " + int_to_string(cntr) + " of " + int_to_string(prediect));
		print("HP=" + my_hp() + " MP=" + my_mp());
		adventure(1, $location[Castle in the Clouds]);
	} 
	# end of adventure loop
} 
# end of script

However, this script no longer seems to work. I haven't changed KoLmafia versions since I wrote it (am using v9.9). It always starts by using a tiny house now, and then adventures until I run out of adventures. Apparently adventure() is just running until it fails, as no more healing checks or status printouts are performed until I run out of adventures. It also stops updating the sidebar in KoLmafia while running this script.

So, what might I have done to break the script? As far as I know, I didn't change anything that would have an impact on this...
 
Top