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

Changing moon cycle in Mystara calendar

So I'm using The Aaron's old Mystara calendar script, and I've modified the number of weeks and month names so that it will work as a Forgotten Realms calendar.  I thought I saw somewhere that there was a way to modify the lunar cycle to a 30 day cycle, rather than the 28 days of the calendar.  If this is possible, can someone let me know how to do this?
Actually, it looks like my modifications might have done something weird to the moon cycle as well...
1485153989
The Aaron
Pro
API Scripter
Change the function _GetPhaseforDate on line 124 to this:     _GetPhaseForDate: function(d,options){         var opt=_.defaults((options||{}),{             showLunarPhases: true         });         let phaseDay=Math.ceil(28/30*d);         return ((opt.showLunarPhases)?(         '<img src="'             +Calendar.clearImage             +'" style="width: '+Calendar.lunarPhaseSize+'px; height: '+Calendar.lunarPhaseSize+'px; background:url('             +Calendar.lunarPhasesImage             +') -'+((phaseDay-1)%7)*Calendar.lunarPhaseSize+'px -'+Math.floor((phaseDay-1)/7)*Calendar.lunarPhaseSize+'px;">'             ):(''));      }, Also, that was my first script, don't judge me! 2nd also, there is an error in the graphic (someone PMd me only a few months ago about it...): I need to make a new one, but I won't be able to change what is in people's scripts already.  You might want to edit the graphic yourself and change out the URL on line 4.  You can use a URL that's publicly available rather than relying on one in Roll20 as this just gets dumped to the chat. Cheers!
Whoops, maybe I have a different version of this script - it says it's "version 1.5 modified with event tracking code The _GetPhaseForDate was actually on line 133, and when I pasted your code in, I an API crash and this error: Spinning up new sandbox... SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode Restarting sandbox due to script changes... Previous shutdown complete, starting up... Spinning up new sandbox... SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode Restarting sandbox due to script changes... Previous shutdown complete, starting up...
1485156905
The Aaron
Pro
API Scripter
Oh yeah...  I did say it was old... change where it says "let" to "var" on the front of phaseDay and that should clear it up. 
Hm... well, that's a change... You made the moon go away!  :)
1485158594
The Aaron
Pro
API Scripter
Novel! Change to using this line: var phaseDay=Math.ceil(28/30*d.day);
Well, that looks better... Except for that little error on the 20th.  I'm not sure how to edit it, though.  Do I just need to find a graphic with four rows and 7 columns?
Ok, so I did a little edit on your image in GIMP, and this is what I came up with... Better?  Now, how can I take that image and get it into my script? EDIT:  Nevermind, I think I got it figured out - I uploaded it to imgur, and after a few trials, got it working. Thanks for your help!
1485180871
The Aaron
Pro
API Scripter
Beautiful!  No problem!