Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

Multi-Moon Calendar Math Help

1604427792
Eli N.
Pro
Compendium Curator
So I am just adapting this calendar of Faerun for use in Tellene (the world of hackmaster). Which has 3 moons, a 28 day cycle. 34 day cycle and an 80 day cycle in a 364 day calendar. I am just trying to figure out what this person did for the moon cycles (the code in question is 437-472 if you look at the github)&nbsp; <a href="https://github.com/Ciorstaidh/Roll20-API/blob/master/Faerun%20Calendar%20v2.4" rel="nofollow">https://github.com/Ciorstaidh/Roll20-API/blob/master/Faerun%20Calendar%20v2.4</a> The lines in question that I am referring to is this section.&nbsp; &nbsp; &nbsp; getmoonV = function() { &nbsp; &nbsp; &nbsp; &nbsp; var ordinal = state.Calendar.now.ordinal; &nbsp; &nbsp; &nbsp; &nbsp; var moonNo; &nbsp; &nbsp; &nbsp; &nbsp; var moon; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; moonNo = Math.ceil(ordinal/3)-Math.floor(Math.ceil(ordinal/3)/8)*8; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; switch(moonNo) { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 1: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; moon = 'First Quarter'; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 2: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; moon = 'Waxing Cresent'; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 3: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; moon = 'New'; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 4: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; moon = 'Waning Cresent'; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 5: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; moon = 'Third Quarter'; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 6: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; moon = 'Waning Gibbous'; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 7: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; moon = 'Full'; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 0: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; moon = 'Waxing Gibbous'; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break; &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return moon; &nbsp; &nbsp; }, So the question for me is how is moonNo calculated? I get dividing by 8 to get the 8 cases, but why is ordinal being divided by 3?&nbsp; Ordinal is the count of days from the 1st day of the year, and I know the moon of Faerun has a 30 day cycle.&nbsp;
1604428537
GiGs
Pro
Sheet Author
API Scripter
That is set up to give the moon a 24 day cycle, it stays on each phase for 3 days.
1604428669
GiGs
Pro
Sheet Author
API Scripter
You have a problem with your world's 3 moons. Two of them dont divide into the year perfectly, so you'd need to track the phases over multiple years and IIRC you cant do that with that script.
1604431877
Eli N.
Pro
Compendium Curator
Thanks GiGs