ASH Almanac commands?

Veloz

New member
I was wondering if there is a way to use Almanac info in an ASH script... here's what I'm looking to do:


  • [li]Call the Almanac and return the Jekyllin Hide belt percentages[/li]
    [li]If the stats are more beneficial than my normal gear, equip my Jekyllin Hide Belt equipped outfit[/li]

This would also be true of anyone that has a Baio or any other moon dependent item.

Does this command already exist?
 
I thought about writing a script to tell me the stats for my Jekyllin hide belts. I never did it, but I was going to use int moon_phase( ) which does not appear to be documented anywhere, but Kolmafia says it's an internal ash function, and the name implies that it could be used in this fashion.
 

Veloz

New member
I suppose that would do it... but seems like the long way around. Perhaps a function for the next release?? ;D
 

Veloz

New member
So, is the moon_phase integer basically the same as the moonlight? I've tried this:

Code:
print("+" + (9 - moon_phase()) + " stats, " + (15 + moon_phase() * 5) + "% items");

...and it seems to be a day behind. Am I on the right track, or way off?
 

holatuwol

Developer
Both moons at new moon is moon phase zero. KoLmafia then counts from 0 to 15, and the number you get back from moon_phase corresponds to that phase number.

In short, moon_phase doesn't tell you anything use about how much moon light there is due to the mini-moon's interference. You're better off using visit_url on the menu pane.
 

Veloz

New member
well then, how about this... 5 lines of code added to KoLmafiaASH.java that return a integer value already calculated in MoonPhaseDatabase.java:

ADD AFTER LINE 3159:

Code:
		params = new ScriptType[] {};
		result.addElement( new ScriptExistingFunction( "moon_light", INT_TYPE, params ) );

ADD AFTER LINE 4560:

Code:
		public ScriptValue moon_light()
		{	return new ScriptValue( MoonPhaseDatabase.getMoonlight() );
		}

This would add int moon_light() that a script could use to calculate the Baio/Jekyllin/Grue/BotW/Grimacite effects in a simple fashion using well-documented formulas. I modified a local build and tested it, and it works great!

Whaddya say? ;D
 

holatuwol

Developer
As mentioned in one of the other threads talking about functions which give you access to internal data, you need to come up with a better use for it if you want me to go through the trouble of copy pasting.

Moods handle the wereseal problem internally, so you can't use that example unless you're clever about it.  I have about 0% sympathy for a script which optimizes gear for item farming or auto-ascension purposes, so jekyllins are out.  Mushroom planting doesn't work either, since that uses moon_phase, not moon_light.  Grues have moonglasses, so that's out (in theory, though there might be a reason you don't have moon glasses and want to use a grue that's not for auto-ascension).

Also, any example needs an actual script sample using that function (in case you never read the other thread).  Even if it's easy to add, I don't want to set a precedent for adding stuff without a solid example of use that doesn't go against what I want KoLmafia to be able to do.  Moon light doesn't look to be in that category, but then again, I haven't given it much thought.
 
Top