question about moon functions

w/r to determining moon phase/light:

I want to do various calculations of item power based on moons, but moon_light(), moon_phase() don't seem to be getting me anywhere.

reference: http://kol.coldfront.net/thekolwiki/index.php/Moons

moon_light() seems to return an out-of-whack value according to the rules on that page.

moon_phase() returns a value that I'm not sure of the validity of because I'm not sure what "phase system" that value is being returned in. according to reference above there are 176 days in the full moon cycle, so should I be expecting a number from 1-176, or just a 1-9 for an individual moon? if the latter, well, which moon? and how do I find out about hamburglar? if the former, well... what if I just want to know the phase of Grimace, for example?

I read a bit of the source to try and figure out how these functions arrive at their return values and saw the warnings about rollover time, time zones, etc. creating possible discrepancies, but all I really want is a scriptable equivalent of looking at the graphic and calculate the current light in KoL, period. no system clock integration should be required for that, right?

looking for some guidance as to #1 what are these functions supposed to be returning (aka are they currently working right?) #2 whether or not my functionality already exists in ash or should I home-roll.
 
I would skip that approach and go with the simpler method of looking at the items directly. In my script where I decide what rollover gear to wear, I have the line:

if (numeric_modifier($item[depleted grimacite grappling hook], "Adventures") >= 2)

If all you care about is the darkness on Grimace, checking any grimacite gear will tell you the important part.
 
moon_phase() returns a value in the range 0..15, corresponding to the possible positions of Ronald and Grimace only - basically, it corresponds to the day of the KoL month. I think you can extract the two main moons from it as follows (not tested):
grimace = moon_phase() / 2;
ronald = moon_phase() - 8 * (moon_phase() * 8);
The individual values would be:
case 0:
return "new moon";
case 1:
return "waxing crescent";
case 2:
return "first quarter";
case 3:
return "waxing gibbous";
case 4:
return "full moon";
case 5:
return "waning gibbous";
case 6:
return "third quarter";
case 7:
return "waning crescent";


moon_light() is the total number of lit moon segments, in the range 0..9. It includes the contribution from the mini-moon.

There is no current function for getting the mini-moon position. The usual reason for people wanting that is to determine the variable effects of Grimacite equipment, which is much more easily done by using numeric_modifier() on the equipment itself. Even if that's not the reason you need the info, you may find that the easiest answer is to use numeric_modifier() on some item that is affected by the same aspect of the moons, and work backwards from the result.
 
Thanks for the replies. I will probably use the numeric_modifier() technique.

I was trying to plug moon_light() into the (15 + 5 * x) equation for the Jekyllin hide belts and some days it was giving a wrong answer.
 
I was trying to plug moon_light() into the (15 + 5 * x) equation for the Jekyllin hide belts and some days it was giving a wrong answer.
Looking back into this subject recently...

For starters: I have some debug code which runs every day at startup, simply printing out the results of that equation, and since my original post -- which, granted was at least 1 if not 2 mafia versions ago -- I have not caught it returning and incorrect value. So that seems at least positive, if not fixed.

But I also have refined my original usage idea and realized what I am really trying to do is compare today's Jek efficiency with tomorrow's. Any tips on how/if this might be possible using ASH right now? TY!
 
I have some debug code which runs every day at startup, simply printing out the results of that equation, and since my original post -- which, granted was at least 1 if not 2 mafia versions ago -- I have not caught it returning and incorrect value. So that seems at least positive, if not fixed.
Ooops... sorry! Have to retract! Last night shortly after rollover, my fn() was returning 50 as Jek item drop %. Now it returns the correct value of 45. Normally, I don't connect until long after rollover, which is why I've probably been seeing the correct values more often than not.

Again, I recall from the source comments the various reasons why this might be happening, so I know this isn't a big alarm. I just didn't want my statement above to be taken as some sort of assurance of fixed-ness! ;)

As for the "how to determine tomorrow's Jek power" question: at this point I am thinking of creating/maintaining (or finding somewhere) a separate moon database outside of mafia and just doing a lookup. Just wondering if there is any inbuilt means of getting that info before I go for the "home-rolled" solution.
 
It's not easy. You'd have to write a function that computes the moonlight of tomorrow's moons. You could use the code on this page as a starting point.

Please post your ash function if you complete it. I'd certainly like to take a looksee.
 
Back
Top