Set Castle Wheel to Minimum Stat

As requested by Salculd (on the KoL Gameplay forums):

Code:
stat minstat()
{
	stat currentstat;
	currentstat = $stat[muscle];
	if( my_basestat( currentstat) > my_basestat( $stat[mysticality]))
	{
		currentstat = $stat[mysticality];
	}
	if( my_basestat( currentstat) > my_basestat( $stat[moxie]))
	{
		currentstat = $stat[moxie];
	}
	return currentstat;
}

void wheeltominstat()
{
	if( minstat() == $stat[muscle])
	{
		cli_execute("set choiceAdventure9=3");
		cli_execute("set choiceAdventure10=2");
		cli_execute("set choiceAdventure11=1");
		cli_execute("set choiceAdventure12=1");
	}
	if( minstat() == $stat[mysticality])
	{
		cli_execute("set choiceAdventure9=1");
		cli_execute("set choiceAdventure10=3");
		cli_execute("set choiceAdventure11=2");
		cli_execute("set choiceAdventure12=1");
	}
	if( minstat() == $stat[moxie])
	{
		cli_execute("set choiceAdventure9=2");
		cli_execute("set choiceAdventure10=2");
		cli_execute("set choiceAdventure11=1");
		cli_execute("set choiceAdventure12=3");
	}
}

void main()
{
	wheeltominstat();
}


Notes:

If there is a tie between two or more stats, it will pick the one that is "highest" on your character pane. ie: Muscle / Mysticality / Moxie - in that order.

It is an ASH script, so if you copy & paste rather than download the following attachment, make sure the extension is .ash

It is written to facilitate importing it. But it can also be run by itself.
 

Attachments

  • WheelToMinStatASH.ash
    1,022 bytes · Views: 64

yuck foo

New member
[quote author=Presto Ragu link=topic=97.msg342#msg342 date=1145379834]
If there is a tie between two or more stats, it will pick the one that is "highest" on your character pane. ie: Muscle / Mysticality / Moxie - in that order.[/quote]

I was looking at this over lunch, and thought I might work on the minstat() function to make it favor your class's primary stat rather than mus / mys / mox. That way, it would favor mox for a DB, if all the stats were equal, or mys for a PM. I don't know if mine will work or not. Look it over and let me know what's wrong with it.

Code:
stat minstat()
{
	stat primary;
	stat secondary;
	stat tertiary;
	stat target:

	if( my_class() == $class[seal clubber])
	{
		primary = $stat[muscle];
		secondary = $stat[moxie];
		tertiary = $stat[mysticality];
	}

	if( my_class() == $class[turtle tamer])
	{
		primary = $stat[muscle];
		secondary = $stat[mysticality];
		tertiary = $stat[moxie];
	}

	if( my_class() == $class[pastamancer])
	{
		primary = $stat[mysticality];
		secondary = $stat[muscle];
		tertiary = $stat[moxie];
	}

	if( my_class() == $class[sauceror])
	{
		primary = $stat[mysticality];
		secondary = $stat[moxie];
		tertiary = $stat[muscle];
	}

	if( my_class() == $class[disco bandit])
	{
		primary = $stat[moxie];
		secondary = $stat[muscle];
		tertiary = $stat[mysticality];
	}

	if( my_class() == $class[accordian thief])
	{
		primary = $stat[moxie];
		secondary = $stat[mysticality];
		tertiary = $stat[muscle];
	}

	# Set target stat to primary...
	#  (This will always prefer your primary stat.)
	target = primary;

	# If secondary stat is clearly least, set target to secondary stat...
	if( my_basestat(secondary) < my_basestat(primary))
	{
		if( my_basestat(secondary) < my_basestat(tertiary))
		{
			target = secondary;
		}
	}

	# If tertiary stat is clearly least, set target to tertiary stat...
	if( my_basestat(tertiary) < my_basestat(primary))
	{
		if( my_basestat(tertiary) < my_basestat(secondary))
		{
			target = tertiary;
		}
	}

	return target;
{


void wheeltominstat()
{
	if( minstat() == $stat[muscle])
	{
		cli_execute("set choiceAdventure9=3");
		cli_execute("set choiceAdventure10=2");
		cli_execute("set choiceAdventure11=1");
		cli_execute("set choiceAdventure12=1");
	}
	if( minstat() == $stat[mysticality])
	{
		cli_execute("set choiceAdventure9=1");
		cli_execute("set choiceAdventure10=3");
		cli_execute("set choiceAdventure11=2");
		cli_execute("set choiceAdventure12=1");
	}
	if( minstat() == $stat[moxie])
	{
		cli_execute("set choiceAdventure9=2");
		cli_execute("set choiceAdventure10=2");
		cli_execute("set choiceAdventure11=1");
		cli_execute("set choiceAdventure12=3");
	}
}

void main()
{
	wheeltominstat();
}

While posting, I noticed a question... Wouldn't it be better to call the minstat() function only once from the wheeltominstat() function rather than three times? The result won't change betwixt the three if statements. Something like...

Code:
target = minstat()
if( target == $stat[muscle])
  ...
if( target == $stat[mysticality])
  ...
if( target == $stat[moxie])
  ...
 

Attachments

  • updated_WheelToMinStat.ash
    2.2 KB · Views: 64
[quote author=yuck foo link=topic=97.msg345#msg345 date=1145386931]
I was looking at this over lunch, and thought I might work on the minstat() function to make it favor your class's primary stat rather than mus / mys / mox. That way, it would favor mox for a DB, if all the stats were equal, or mys for a PM. I don't know if mine will work or not. Look it over and let me know what's wrong with it.[/quote]

It looks like it would work fine... And better than my quick script.

I was only making an example that I had promised the night before. And I was deterring a feature request that wasn't needed...

[quote author=yuck foo link=topic=97.msg345#msg345 date=1145386931]
While posting, I noticed a question... Wouldn't it be better to call the minstat() function only once from the wheeltominstat() function rather than three times? The result won't change betwixt the three if statements.
[/quote]

Um... Sure. That is definitely a better way to do it.

And if you have been paying attention to my posting here, you would have already picked up on the fact that my first offers are never made the best way they should be. :p My methodology seems to be functional, then elegant. :p

((And just in case people can't tell, I took no offense at the improvements to my script. :D ))
 

yuck foo

New member
[quote author=Presto Ragu link=topic=97.msg358#msg358 date=1145419503]((And just in case people can't tell, I took no offense at the improvements to my script. :D ))[/quote]

Glad to hear it. I prob'ly wouldn't be hanging out here if people got upset about others improving their work. If I post something, I'm always hoping somebody will point out where it can be made better.

Looking at my addition, again, I see at least three typos... A colon instead of a semi-colon, an open brace instead of a close, and apparently I can't spell "accordion".

[quote author=Presto Ragu]My methodology seems to be functional, then elegant.[/quote]

I work pretty much the same way... Bodge something out that works, then trim out the fat.

So, my question is: How would I use this script? Would I have to add an entry to the Custon Combat setting page?
 

macman104

Member
Yuck Foo said:
So, my question is: How would I use this script? Would I have to add an entry to the Custon Combat setting page?
I was thinking you'd run it as an inbetween battle script. Then when you encounter the wheel, your choice options will be set.
 
If not an inbetween battle script, then part of a farming script...

Code:
import <WheelToMinStatASH.ash>;

void main()
{
   while( my_adventures() > 10)
   {
     wheeltominstat();
     adventure( 10, $location[The Castle in the Clouds in the Sky]);
   }
}

As an example.
 
Top