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 .
×
Advertisement Create a free account

Moon images no longer showing in Greyhawk calendar API

1626698488
Hi all, I've been playing on Roll20 since the pandemic started, and, over the course of the last year or so, I've installed a number of APIs for my current game - all of which were working fine until recently. I hadn't logged on to my game for a couple of months prior to day, and when I did I noticed I was getting missing images for the moons using this API&nbsp; <a href="https://github.com/Ciorstaidh/Roll20-API/blob/master/Multi-World%20Calendar%20v6.2.0" rel="nofollow">https://github.com/Ciorstaidh/Roll20-API/blob/master/Multi-World%20Calendar%20v6.2.0</a> Quite literally nothing in my game has changed, and I can't for the life of me work out why the images aren't showing - the rest of the API works fine in terms of advancing game time, showing to players, etc. Anyone got any ideas please?
1626698698
Oh, just to add - I started a new, clean game, and installed the API there and I got the same issue.
1626704695
The Aaron
Forum Champion
API Scripter
The issue is with the images hosted on the Internet. I made an updated version with a different set of moon phases (all hosted on Roll20) and sent it to Kirsty over the weekend. She'll probably update the repo soon, but here it is if you want to try it: /* Calendar for Eberron, Faerun, Greyhawk, Modern and Tal'Dorei Settings Created by Kirsty (<a href="https://app.roll20.net/users/1165285/kirsty" rel="nofollow">https://app.roll20.net/users/1165285/kirsty</a>) Many thanks to Aaron (<a href="https://app.roll20.net/users/104025/the-aaron" rel="nofollow">https://app.roll20.net/users/104025/the-aaron</a>) for his NoteLog script, parts of which I "borrowed" API Commands: !cal (as Player) - Shows world, date, time, moon, weather and counted days !cal (as GM) - Same as player but includes options to advance the date/time, alter the weather, add a note or view the settings menu. !calSet (GM only) - Allows the GM to change the world, date, time display, show/hide days until full moon, adjust day counter or set the start date Red Colour: #7E2D40 */ var Calendar = Calendar || (function() { 'use strict'; var version = '6.2.0', handoutName = 'Events Log', setDefaults = function() { state.Calendar = { now: { version: '6.2.0', world: 1, ordinal: 1, year: 1486, down: 0, divider: 0, weather: "It is a cool but sunny day.", timetype: "OFF", time: "Noon", mooncount: "OFF", startdate: "1,Hammer,1486", events: "" }, }; }, checkDefaults = function() { if( state.Calendar.now.version != version ){ state.Calendar.now.version = version; } if( ! state.Calendar.now.world){state.Calendar.now.world = 1}; if( ! state.Calendar.now.ordinal){state.Calendar.now.ordinal = 1}; if( ! state.Calendar.now.year){state.Calendar.now.year = 1486}; if( ! state.Calendar.now.down){state.Calendar.now.down = '0'}; if( ! state.Calendar.now.divider){state.Calendar.now.divider = '0'}; if( ! state.Calendar.now.weather){state.Calendar.now.weather = "It is a cool but sunny day."}; if( ! state.Calendar.now.timetype){state.Calendar.now.timetype = "OFF"}; if( ! state.Calendar.now.time){state.Calendar.now.time = "Noon"}; if( ! state.Calendar.now.time){state.Calendar.now.mooncount = "OFF"}; if( ! state.Calendar.now.startdate){state.Calendar.now.startdate = "1,Hammer,1486"}; if( ! state.Calendar.now.startdate){state.Calendar.now.events = ""}; }, handleInput = function(msg) { var args = msg.content.split(","); if (msg.type !== "api") { return; } if(playerIsGM(msg.playerid)){ switch(args[0]) { case '!cal': calmain(); break; case '!settings': calmenu(); break; case '!setworld': state.Calendar.now.world=args[1]; calmenu(); break; case '!startdate': state.Calendar.now.startdate=args[1]+','+args[2]+','+args[3]; calmenu(); break; case '!setday': switch(Number(state.Calendar.now.world)) { case 1: getFaerunOrdinal(msg); break; case 2: getGreyhawkOrdinal(msg); break; case 3: getModernOrdinal(msg); break; case 4: getEberronOrdinal(msg); break; case 5: getTalOrdinal(msg); break; } weather(); calmenu(); break; case '!setmonth': switch(Number(state.Calendar.now.world)) { case 1: getFaerunOrdinal(msg); break; case 2: getGreyhawkOrdinal(msg); break; case 3: getModernOrdinal(msg); break; case 4: getEberronOrdinal(msg); break; case 5: getTalOrdinal(msg); break; } weather(); calmenu(); break; case '!setyear': state.Calendar.now.year=args[1]; calmenu(); break; case '!setordinal': state.Calendar.now.ordinal=args[1]; calmenu(); break; case '!settimetype': var type = args[1]; state.Calendar.now.timetype=type; if (type == 'OFF') { state.Calendar.now.time = 'OFF' }; if (type == 'General') { state.Calendar.now.time = 'Morning (dawn)' }; if (type == '24 Hour') { state.Calendar.now.time = '00:00' }; calmenu(); break; case '!settime': var type = state.Calendar.now.timetype; if (type == 'General'){ state.Calendar.now.time = args[1]; } else if (type == '24 Hour') { state.Calendar.now.time = args[1]+args[2]; } calmain(); break; case '!setdown': var down = Number(args[1]); state.Calendar.now.down = down; getdown(down); calmain(); break; case '!setdiv': state.Calendar.now.divider=Number(args[1]); calmenu(); break; case '!mooncounter': state.Calendar.now.mooncount=args[1]; calmenu(); break; case '!addday': addday(args[1]); weather(); calmain(); break; case '!addtime': addtime(args[1], args[2]); calmain(); break; case '!weather': if(args[1]=='Roll}'){ weather(); }else{ var string = args[1]; for (var i = 2; i &lt; args.length; i++) { string = string + ", " + args[i]; } state.Calendar.now.weather = string; } calmain(); break; case '!log': log(msg); break; case '!playercal': showcal(msg); break; } }else if(args[0]=='!cal'){ showcal(msg); } }, calstyle = function() { var colour = '#7E2D40'; var divstyle = 'style="width: 189px; border: 1px solid black; background-color: #ffffff; padding: 5px; font-size: 12px;"' var astyle1 = 'style="text-align:center; border: 1px solid black; margin: 1px; padding: 2px; background-color: ' + colour + '; border-radius: 4px; box-shadow: 1px 1px 1px #707070; width: 100px;'; var astyle2 = 'style="text-align:center; border: 1px solid black; margin: 1px; padding: 2px; background-color: ' + colour + '; border-radius: 4px; box-shadow: 1px 1px 1px #707070; width: 150px;'; var tablestyle = 'style="border: none;"'; var arrowstyle = 'style="border: none; border-top: 3px solid transparent; border-bottom: 3px solid transparent; border-left: 195px solid ' + colour + '; margin-bottom: 2px; margin-top: 2px;"'; var headstyle = 'style="color: ' + colour + '; font-size: 18px; text-align: left; font-variant: small-caps; font-family: Times, serif;"'; var substyle = 'style="font-size: 11px; line-height: 13px; margin-top: -3px; font-style: italic;"'; var tdstyle = 'style="padding: 2px; padding-left: 5px; border: none;"'; var styles = colour + '|' + divstyle + '|' + astyle1 + '|' + astyle2 + '|' + tablestyle + '|' + arrowstyle + '|' + headstyle + '|' + substyle + '|' + tdstyle; return styles; }, calmain = function() { var styles = calstyle().split("|"); var colour = styles[0]; var divstyle = styles[1]; var astyle1 = styles[2]; var astyle2 = styles[3]; var tablestyle = styles[4]; var arrowstyle = styles[5]; var headstyle = styles[6]; var substyle = styles[7]; var tdstyle = styles[8]; var world = getworld(); var down = Number(state.Calendar.now.down); down = getdown(down); var moMenu = getMoMenu(); var ordinal = state.Calendar.now.ordinal; var nowdate; switch(Number(state.Calendar.now.world)) { case 1: nowdate = getFaerunDate(ordinal).split(','); break; case 2: nowdate = getGreyhawkDate(ordinal).split(','); break; case 3: nowdate = getModernDate(ordinal).split(','); break; case 4: nowdate = getEberronDate(ordinal).split(','); break; case 5: nowdate = getTalDate(ordinal).split(','); break; } var month = nowdate[0]; var day = nowdate[1]; var suffix = getsuffix(day); var moon; if (state.Calendar.now.world==1){ moon = getFaerunMoon(); }else if(state.Calendar.now.world==2){ moon = getGreyhawkMoon(); }else{ moon = ''; } var start = state.Calendar.now.startdate.split(','); var startdate = start[0]+getsuffix(start[0])+' '+start[1]+', '+start[2]; var timeselect = timemenu(); sendChat('Calendar', '/w gm &lt;div ' + divstyle + '&gt;' + //-- '&lt;div ' + headstyle + '&gt;Calendar&lt;/div&gt;' + //-- '&lt;div ' + substyle + '&gt;Menu (v.' + state.Calendar.now.version + ')&lt;/div&gt;' + //-- '&lt;div ' + arrowstyle + '&gt;&lt;/div&gt;' + //-- '&lt;table ' + tablestyle + '&gt;' + //-- '&lt;tr&gt;&lt;td ' + tdstyle + '&gt;World: &lt;/td&gt;&lt;td ' + tdstyle + '&gt;' + world + '&lt;/td&gt;&lt;/tr&gt;' + //-- '&lt;tr&gt;&lt;td ' + tdstyle + '&gt;Date: &lt;/td&gt;&lt;td ' + tdstyle + '&gt;'+ month + ' ' + day + suffix + ', ' + state.Calendar.now.year + '&lt;/td&gt;&lt;/tr&gt;' + //-- '&lt;tr&gt;&lt;td ' + tdstyle + '&gt;Days: &lt;/td&gt;&lt;td ' + tdstyle + '&gt;&lt;a ' + astyle1 + '"href="!setdown,?{Down Days}"&gt;' + down + '&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;' + //-- '&lt;tr&gt;&lt;td ' + tdstyle + '&gt;Time: &lt;/td&gt;&lt;td ' + tdstyle + '&gt;&lt;a ' + astyle1 + '" href="!settime,'+ timeselect + '"&gt;' + state.Calendar.now.time + '&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;' + //-- '&lt;tr&gt;&lt;td ' + tdstyle + '&gt;Moon: &lt;/td&gt;&lt;td ' + tdstyle + '&gt;' + moon + //-- '&lt;/table&gt;' + //-- 'Weather: ' + state.Calendar.now.weather + //-- '&lt;br&gt;&lt;br&gt;&lt;div style="text-align:center;"&gt;&lt;a ' + astyle2 + '" href="!addday,?{Days to add?|1}"&gt;Advance the Date&lt;/a&gt;&lt;/div&gt;' + //-- '&lt;div style="text-align:center;"&gt;&lt;a ' + astyle2 + '" href="!addtime,?{Advance how many hours?|0},?{Advance how many minutes?|0}"&gt;Advance the Time&lt;/a&gt;&lt;/div&gt;' + //-- '&lt;div style="text-align:center;"&gt;&lt;a ' + astyle2 + '" href="!weather,?{Weather|Roll|Edit,?{Edit Weather}}"&gt;Change Weather&lt;/a&gt;&lt;/div&gt;' + //-- '&lt;div style="text-align:center;"&gt;&lt;a ' + astyle2 + '" href="!log,?{Include time?|Yes|No},?{Notes}"&gt;Log Day&lt;/a&gt;&lt;/div&gt;' + //-- '&lt;div style="text-align:center;"&gt;&lt;a ' + astyle2 + '" href="!playercal"&gt;Show to Players&lt;/a&gt;&lt;/div&gt;' + //-- '&lt;div style="text-align:center;"&gt;&lt;a ' + astyle2 + '" href="!settings"&gt;Settings&lt;/a&gt;&lt;/div&gt;' + //-- '&lt;/div&gt;' ); }, calmenu = function() { var styles = calstyle().split("|"); var colour = styles[0]; var divstyle = styles[1]; var astyle1 = styles[2]; var astyle2 = styles[3]; var tablestyle = styles[4]; var arrowstyle = styles[5]; var headstyle = styles[6]; var substyle = styles[7]; var tdstyle = styles[8]; var world = getworld(); var down = Number(state.Calendar.now.down); down = getdown(down); var moMenu = getMoMenu(); var ordinal = state.Calendar.now.ordinal; var nowdate; switch(Number(state.Calendar.now.world)) { case 1: nowdate = getFaerunDate(ordinal).split(','); break; case 2: nowdate = getGreyhawkDate(ordinal).split(','); break; case 3: nowdate = getModernDate(ordinal).split(','); break; case 4: nowdate = getEberronDate(ordinal).split(','); break; case 5: nowdate = getTalDate(ordinal).split(','); break; } var month = nowdate[0]; var day = nowdate[1]; var start = state.Calendar.now.startdate.split(','); var startdate = start[0]+getsuffix(start[0])+' '+start[1]+', '+start[2]; var timeselect = timemenu(); sendChat('Calendar', '/w gm &lt;div ' + divstyle + '&gt;' + //-- '&lt;div ' + headstyle + '&gt;Calendar&lt;/div&gt;' + //-- '&lt;div ' + substyle + '&gt;Menu (v.' + state.Calendar.now.version + ')&lt;/div&gt;' + //-- '&lt;div ' + arrowstyle + '&gt;&lt;/div&gt;' + //-- '&lt;table ' + tablestyle + '&gt;' + //-- '&lt;tr&gt;&lt;td ' + tdstyle + '&gt;World: &lt;/td&gt;&lt;td ' + tdstyle + '&gt;&lt;a ' + astyle1 + '" href="!setworld,?{World?|Faerûn,1|Greyhawk,2|Modern,3|Eberron,4|Tal\'Dorei,5}"&gt;' + world + '&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;' + //-- '&lt;tr&gt;&lt;td ' + tdstyle + '&gt;Start Date: &lt;/td&gt;&lt;td ' + tdstyle + '&gt;&lt;a ' + astyle1 + '" href="!startdate,?{Day},?{Month},?{Year}"&gt;' + startdate + '&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;' + //-- '&lt;tr&gt;&lt;td ' + tdstyle + '&gt;Day: &lt;/td&gt;&lt;td ' + tdstyle + '&gt;&lt;a ' + astyle1 + '" href="!setday,?{Day?|1},' + month +'"&gt;' + day + '&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;' + //-- '&lt;tr&gt;&lt;td ' + tdstyle + '&gt;Month: &lt;/td&gt;&lt;td ' + tdstyle + '&gt;&lt;a ' + astyle1 + '" href="!setmonth,' + day + moMenu + month + '&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;' + //-- '&lt;tr&gt;&lt;td ' + tdstyle + '&gt;Year: &lt;/td&gt;&lt;td ' + tdstyle + '&gt;&lt;a ' + astyle1 + '" href="!setyear,?{Year?|1486}"&gt;' + state.Calendar.now.year + '&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;' + //-- //'&lt;tr&gt;&lt;td ' + tdstyle + '&gt;Ordinal: &lt;/td&gt;&lt;td ' + tdstyle + '&gt;&lt;a ' + astyle1 + '" href="!setordinal,?{Ordinal?|1}"&gt;' + ordinal + '&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;' + //- '&lt;tr&gt;&lt;td ' + tdstyle + '&gt;Time type: &lt;/td&gt;&lt;td ' + tdstyle + '&gt;&lt;a ' + astyle1 + '" href="!settimetype,?{Time?|OFF|24 Hour|General}"&gt;' + state.Calendar.now.timetype + '&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;' + //- '&lt;tr&gt;&lt;td ' + tdstyle + '&gt;Time: &lt;/td&gt;&lt;td ' + tdstyle + '&gt;&lt;a ' + astyle1 + '" href="!settime,'+ timeselect + '"&gt;' + state.Calendar.now.time + '&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;' + //-- '&lt;tr&gt;&lt;td ' + tdstyle + '&gt;Down Day&lt;br&gt;Divider: &lt;/td&gt;&lt;td ' + tdstyle + '&gt;&lt;a ' + astyle1 + '" href="!setdiv,?{Down Day Divider?|1}"&gt;' + state.Calendar.now.divider + '&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;' + //-- '&lt;tr&gt;&lt;td ' + tdstyle + '&gt;Moon Counter: &lt;/td&gt;&lt;td ' + tdstyle + '&gt;&lt;a ' + astyle1 + '" href="!mooncounter,?{Moon Counter|OFF|ON}"&gt;' + state.Calendar.now.mooncount + '&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;' + //-- '&lt;/table&gt;' + //-- '&lt;div style="text-align:center;"&gt;&lt;a ' + astyle2 + '" href="!cal"&gt;Main Menu&lt;/a&gt;&lt;/div&gt;' + //-- '&lt;/div&gt;' ); }, showcal = function(msg) { var nowdate; var ordinal = state.Calendar.now.ordinal; switch(Number(state.Calendar.now.world)) { case 1: nowdate = getFaerunDate(ordinal).split(','); break; case 2: nowdate = getGreyhawkDate(ordinal).split(','); break; case 3: nowdate = getModernDate(ordinal).split(','); break; case 4: nowdate = getEberronDate(ordinal).split(','); break; case 5: nowdate = getTalDate(ordinal).split(','); break; } var month = nowdate[0]; var day = nowdate[1]; var down = state.Calendar.now.down; down = getdown(down); var suffix = getsuffix(day); var world = getworld(); var colour = '#7E2D40'; var divstyle = 'style="width: 189px; border: 1px solid black; background-color: #ffffff; padding: 5px;"' var tablestyle = 'style="text-align:center;"'; var arrowstyle = 'style="border: none; border-top: 3px solid transparent; border-bottom: 3px solid transparent; border-left: 195px solid ' + colour + '; margin-bottom: 2px; margin-top: 2px;"'; var headstyle = 'style="color: ' + colour + '; font-size: 18px; text-align: left; font-variant: small-caps; font-family: Times, serif;"'; var substyle = 'style="font-size: 11px; line-height: 13px; margin-top: -3px; font-style: italic;"'; var moon; if (state.Calendar.now.world==1){ moon = '&lt;table style = "border: none;"&gt;&lt;tr&gt;&lt;td style="border: none; padding: 2px; padding-left: 5px;"&gt;Moon:&lt;/td&gt;&lt;td style="border: none; padding: 2px; padding-left: 5px;"&gt;'+getFaerunMoon()+'&lt;/table&gt;'; }else if(state.Calendar.now.world==2){ moon = '&lt;table style = "border: none;"&gt;&lt;tr&gt;&lt;td style="border: none; padding: 2px; padding-left: 5px;"&gt;Moon:&lt;/td&gt;&lt;td style="border: none; padding: 2px; padding-left: 5px;"&gt;'+getGreyhawkMoon()+'&lt;/table&gt;'; }else{ moon = ''; } var timestr; var downstr; if(state.Calendar.now.time!="OFF"){ timestr = '&lt;br&gt;The time is: '+state.Calendar.now.time; }else{ timestr = ''; } if(down!=0){ downstr = '&lt;br&gt;Players have ' + down + ' down days.'; }else{ downstr = ''; } sendChat(msg.who, '&lt;div ' + divstyle + '&gt;' + //-- '&lt;div ' + headstyle + '&gt;Calendar&lt;/div&gt;' + //-- '&lt;div ' + substyle + '&gt;' + world + '&lt;/div&gt;' + //-- '&lt;div ' + arrowstyle + '&gt;&lt;/div&gt;' + //-- month + ' ' + day + suffix + ', ' + state.Calendar.now.year + //-- timestr + //-- downstr + //-- moon + //-- 'Today\'s weather:&lt;br&gt;' + state.Calendar.now.weather ); }, getworld = function() { var num = Number(state.Calendar.now.world); var world; switch(num) { case 1: world = 'Faerûn'; break; case 2: world = 'Greyhawk'; break; case 3: world = 'Modern'; break; case 4: world = 'Eberron'; break; case 5: world = 'Tal\'Dorei'; break; } return world; }, getdown = function(days) { var down = Number(days); var div = Number(state.Calendar.now.divider); if(div!=0){ down = down/div; } return down; }, getMoMenu = function() { var world = Number(state.Calendar.now.world); var leap = checkLeap(); var moMenu; switch(world){ case 1: if(leap==0){ moMenu = ',?{Month|Hammer|Midwinter|Alturiak|Ches|Tarsakh|Greengrass|Mirtul|Kythorn|Flamerule|Midsummer|Eleasias|Eleint|Highharvestide|Marpenoth|Uktar|Feast of the Moon|Nightal}"&gt;'; }else{ moMenu = ',?{Month|Hammer|Midwinter|Alturiak|Ches|Tarsakh|Greengrass|Mirtul|Kythorn|Flamerule|Midsummer|Sheildmeet|Eleasias|Eleint|Highharvestide|Marpenoth|Uktar|Feast of the Moon|Nightal}"&gt;'; } break; case 2: moMenu = ',?{Month|Needfest|Fire Seek|Readying|Coldeven|Growfest|Planting|Flocktime|Wealsun|Richfest|Reaping|Goodmonth|Harvester|Brewfest|Patchwall|Ready\'reat|Sunsebb}"&gt;'; break; case 3: moMenu = ',?{Month|January|February|March|April|May|June|July|August|September|October|November|December}"&gt;'; break; case 4: moMenu = ',?{Month|Zarantyr|Olarune|Therendor|Eyre|Dravago|Nymm|Lharvion|Barrakas|Rhaan|Sypheros|Aryth|Vult}"&gt;'; break; case 5: moMenu = ',?{Month|Horisal|Misuthar|Dualahei|Thunsheer|Unndilar|Brussendar|Sydenstar|Fessuran|Quen\'pillar|Cuersaar|Duscar}"&gt;'; } return moMenu; }, checkLeap = function(){ var leap; var remainder; var world = Number(state.Calendar.now.world); var year = Number(state.Calendar.now.year); switch(world){ case 1: remainder = year % 4; if(remainder==0){ leap = 1; }else{ leap = 0; } break; case 2: leap = 0; break; case 3: if(year % 4 != 0){ leap = 0; }else if(year % 100 != 0){ leap = 1; }else if(year % 400 != 0){ leap = 0; }else{ leap = 1; } break; case 4: leap = 0; break; case 5: leap = 0; break; } return leap; }, getFaerunDate = function(options){ var day = Number(options); var date; var month; if(day&gt;0 &amp;&amp; day&lt;=30){ month="Hammer"; date=day; }else if(day==31){ month="Midwinter"; date='festival'; }else if(day&gt;31 &amp;&amp; day&lt;=61){ month="Alturiak"; date=day-31; }else if(day&gt;61 &amp;&amp; day&lt;=91){ month="Ches"; date=day-61; }else if(day&gt;91 &amp;&amp; day&lt;=121){ month="Tarsakh"; date=day-91; }else if(day==122){ month="Greengrass"; date='festival'; }else if(day&gt;122 &amp;&amp; day&lt;=152){ month="Mirtul"; date=day-122; }else if(day&gt;152 &amp;&amp; day&lt;=182){ month="Kythorn"; date=day-152; }else if(day&gt;182 &amp;&amp; day&lt;=212){ month="Flamerule"; date=day-182; }else if(day==213){ month="Midsummer"; date='festival'; }else if(day==214){ month="Sheildmeet"; date='festival'; }else if(day&gt;214 &amp;&amp; day&lt;=244){ month="Eleasias" date=day-214; }else if(day&gt;244 &amp;&amp; day&lt;=274){ month="Eleint"; date=day-244; }else if(day==275){ month="Highharvestide"; date='festival'; }else if(day&gt;275 &amp;&amp; day&lt;=305){ month="Marpenoth"; date=day-275; }else if(day&gt;305 &amp;&amp; day&lt;=335){ month="Uktar"; date=day-305; }else if(day==336){ month="Feast of the Moon"; date='festival'; }else if(day&gt;336 &amp;&amp; day&lt;=366){ month="Nightal"; date=day-336; }else{ month="Hammer"; date='1'; } var array=month+','+String(date); return array; }, getGreyhawkDate = function(options){ var day = Number(options); var date; var month; if(day&gt;0 &amp;&amp; day&lt;=7){ month="Needfest"; date=day; }else if(day&gt;7 &amp;&amp; day&lt;=35){ month="Fire Seek"; date=day-7; }else if(day&gt;35 &amp;&amp; day&lt;=63){ month="Readying"; date=day-35; }else if(day&gt;63 &amp;&amp; day&lt;=91){ month="Coldeven"; date=day-63; }else if(day&gt;91 &amp;&amp; day&lt;=98){ month="Growfest"; date=day-91; }else if(day&gt;98 &amp;&amp; day&lt;=126){ month="Planting"; date=day-98; }else if(day&gt;126 &amp;&amp; day&lt;=154){ month="Flocktime"; date=day-126; }else if(day&gt;154 &amp;&amp; day&lt;=182){ month="Wealsun"; date=day-154; }else if(day&gt;182 &amp;&amp; day&lt;=189){ month="Richfest"; date=day-182; }else if(day&gt;189 &amp;&amp; day&lt;=217){ month="Reaping"; date=day-189; }else if(day&gt;217 &amp;&amp; day&lt;=245){ month="Goodmonth" date=day-217; }else if(day&gt;245 &amp;&amp; day&lt;=273){ month="Harvester"; date=day-245; }else if(day&gt;273 &amp;&amp; day&lt;=280){ month="Brewfest"; date=day-273; }else if(day&gt;280 &amp;&amp; day&lt;=308){ month="Patchwall"; date=day-280; }else if(day&gt;308 &amp;&amp; day&lt;=336){ month="Ready\'reat"; date=day-308; }else if(day&gt;336 &amp;&amp; day&lt;=364){ month="Sunsebb"; date=day-336; }else{ month="Needfest"; date='1'; } var array=month+','+String(date); return array; }, getModernDate = function(options){ var day = Number(options); var date; var month; if(day&gt;0 &amp;&amp; day&lt;=31){ month="January"; date=day; }else if(day&gt;31 &amp;&amp; day&lt;=59){ month="February"; date=day-31; }else if(day&gt;59 &amp;&amp; day&lt;=90){ month="March"; date=day-59; }else if(day&gt;90 &amp;&amp; day&lt;=120){ month="April"; date=day-90; }else if(day&gt;120 &amp;&amp; day&lt;=151){ month="May"; date=day-120; }else if(day&gt;151 &amp;&amp; day&lt;=181){ month="June"; date=day-151; }else if(day&gt;181 &amp;&amp; day&lt;=212){ month="July"; date=day-181; }else if(day&gt;212 &amp;&amp; day&lt;=243){ month="August"; date=day-212; }else if(day&gt;243 &amp;&amp; day&lt;=273){ month="September"; date=day-243; }else if(day&gt;273 &amp;&amp; day&lt;=304){ month="October"; date=day-273; }else if(day&gt;304 &amp;&amp; day&lt;=334){ month="November" date=day-304; }else if(day&gt;334 &amp;&amp; day&lt;=365){ month="December"; date=day-334; }else{ month="January"; date='1'; } var array=month+','+String(date); return array; }, getEberronDate = function(options){ var day = Number(options); var date; var month; if(day&lt;=28){ month = 'Zarantyr'; date = day; }else if(day&lt;=56){ month = 'Olarune'; date = day-28; }else if(day&lt;=84){ month = 'Therendor'; date = day-56; }else if(day&lt;=112){ month = 'Eyre'; date = day-84; }else if(day&lt;=140){ month = 'Dravago'; date = day-112; }else if(day&lt;=168){ month = 'Nymm'; date = day-140; }else if(day&lt;=196){ month = 'Lharvion'; date = day-168; }else if(day&lt;=224){ month = 'Rhaan'; date = day-196; }else if(day&lt;=252){ month = 'Sypheros'; date = day-224; }else if(day&lt;=280){ month = 'Aryth'; date = day-252; }else if(day&lt;=308){ month = 'Vult'; date = day-280; }else{ month = 'Zarantyr'; date = 1; } var array=month+','+String(date); return array; }, getTalDate = function(options){ var day = Number(options); var date; var month; if(day&gt;0 &amp;&amp; day&lt;=29){ month="Horisal"; date=day; }else if(day&gt;29 &amp;&amp; day&lt;=59){ month="Misuthar"; date=day-29; }else if(day&gt;59 &amp;&amp; day&lt;=89){ month="Dualahei"; date=day-59; }else if(day&gt;89 &amp;&amp; day&lt;=120){ month="Thunsheer"; date=day-89; }else if(day&gt;120 &amp;&amp; day&lt;=148){ month="Unndilar"; date=day-120; }else if(day&gt;148 &amp;&amp; day&lt;=179){ month="Brusendar"; date=day-148; }else if(day&gt;179 &amp;&amp; day&lt;=211){ month="Sydenstar"; date=day-179; }else if(day&gt;211 &amp;&amp; day&lt;=240){ month="Fessuran"; date=day-211; }else if(day&gt;240 &amp;&amp; day&lt;=267){ month="Quen\'pillar"; date=day-240; }else if(day&gt;267 &amp;&amp; day&lt;=296){ month="Cuersaar"; date=day-267; }else if(day&gt;296 &amp;&amp; day&lt;=328){ month="Duscar" date=day-296; }else{ month="Horisal"; date='1'; } var array=month+','+String(date); return array; }, getFaerunOrdinal = function(options){ var args = options.content.split(","); var date = args[1]; var month = args[2]; var ordinal = state.Calendar.now.ordinal; if(date == 'festival'){ date = 1; }else{ date = Number(args[1]); } switch(month) { case 'Hammer': ordinal = date; break; case 'Midwinter': ordinal = 31; break; case 'Alturiak': ordinal = 31+date; break; case 'Ches': ordinal = 61+date; break; case 'Tarsakh': ordinal = 91+date; break; case 'Greengrass': ordinal = 122; break; case 'Mirtul': ordinal = 122+date; break; case 'Kythorn': ordinal = 152+date; break; case 'Flamerule': ordinal = 182+date; break; case 'Midsummer': ordinal = 213; break; case 'Sheildmeet': ordinal = 214; break; case 'Eleasias': ordinal = 214+date; break; case 'Eleint': ordinal = 244+date; break; case 'Highharvestide': ordinal = 275; break; case 'Marpenoth': ordinal = 275+date; break; case 'Uktar': ordinal = 305+date; break; case 'Feast of the Moon': ordinal = 335+date; break; case 'Nightal': ordinal = 336+date; break; } state.Calendar.now.ordinal = ordinal; }, getGreyhawkOrdinal = function(options){ var args = options.content.split(","); var date = args[1]; var month = args[2]; var ordinal = state.Calendar.now.ordinal; if(date == 'festival'){ date = 1; }else{ date = Number(args[1]); } switch(month) { case 'Needfest': ordinal = date; break; case 'Fire Seek': ordinal = 7+date; break; case 'Readying': ordinal = 35+date; break; case 'Coldeven': ordinal = 63+date; break; case 'Growfest': ordinal = 91+date; break; case 'Planting': ordinal = 98+date; break; case 'Flocktime': ordinal = 126+date; break; case 'Wealsun': ordinal = 154+date; break; case 'Richfest': ordinal = 182+date; break; case 'Reaping': ordinal = 189+date; break; case 'Goodmonth': ordinal = 217+date; break; case 'Harvester': ordinal = 245+date; break; case 'Brewfest': ordinal = 273+date; break; case 'Patchwall': ordinal = 280+date; break; case 'Ready\'reat': ordinal = 308+date; break; case 'Sunsebb': ordinal = 336+date; break; } state.Calendar.now.ordinal = ordinal; }, getModernOrdinal = function(options){ var args = options.content.split(","); var date = Number(args[1]); var month = args[2]; var ordinal = state.Calendar.now.ordinal; switch(month) { case 'January': ordinal = date; break; case 'February': ordinal = 31+date; break; case 'March': ordinal = 60+date; break; case 'April': ordinal = 91+date; break; case 'May': ordinal = 121+date; break; case 'June': ordinal = 152+date; break; case 'July': ordinal = 182+date; break; case 'August': ordinal = 213+date; break; case 'September': ordinal = 244+date; break; case 'October': ordinal = 274+date; break; case 'November': ordinal = 305+date; break; case 'December': ordinal = 366+date; break; } state.Calendar.now.ordinal = ordinal; }, getEberronOrdinal = function(options){ var args = options.content.split(","); var date = Number(args[1]); var month = args[2]; var ordinal = state.Calendar.now.ordinal; switch(month) { case 'Zarantyr': ordinal = date; break; case 'Olarune': ordinal = 28+date; break; case 'Therendor': ordinal = 56+date; break; case 'Eyre': ordinal = 84+date; break; case 'Dravago': ordinal = 112+date; break; case 'Nymm': ordinal = 140+date; break; case 'Lharvion': ordinal = 168+date; break; case 'Barrakas': ordinal = 196+date; break; case 'Rhaan': ordinal = 224+date; break; case 'Sypheros': ordinal = 252+date; break; case 'Aryth': ordinal = 280+date; break; case 'Vult': ordinal = 308+date; break; } state.Calendar.now.ordinal = ordinal; }, getTalOrdinal = function(options){ var args = options.content.split(","); var date = Number(args[1]); var month = args[2]; var ordinal = state.Calendar.now.ordinal; switch(month) { case 'Horisal': ordinal = date; break; case 'Misuthar': ordinal = 29+date; break; case 'Dualahei': ordinal = 59+date; break; case 'Thunsheer': ordinal = 89+date; break; case 'Unndilar': ordinal = 120+date; break; case 'Brussendar': ordinal = 148+date; break; case 'Sydenstar': ordinal = 179+date; break; case 'Fessuran': ordinal = 211+date; break; case 'Quen\'pillar': ordinal = 240+date; break; case 'Cuersaar': ordinal = 267+date; break; case 'Duscar': ordinal = 296+date; break; } state.Calendar.now.ordinal = ordinal; }, addday = function(no){ var leap = checkLeap(); var days = Number(no); var ordinal = Number(state.Calendar.now.ordinal); var world = Number(state.Calendar.now.world); var div = state.Calendar.now.divider; if(div!=0){ state.Calendar.now.down = Number(state.Calendar.now.down)+days; } var newordinal = ordinal+days; switch(world){ case 1: if(leap==0 &amp;&amp; ordinal &lt;= 214 &amp;&amp; newordinal &gt;= 214){ state.Calendar.now.ordinal = newordinal+1; }else{ state.Calendar.now.ordinal = newordinal; } if(newordinal&gt;366){ state.Calendar.now.ordinal=newordinal-366; state.Calendar.now.year = Number(state.Calendar.now.year)+1; } break; case 2: if(newordinal&gt;364){ state.Calendar.now.ordinal=newordinal-364; state.Calendar.now.year = Number(state.Calendar.now.year)+1; }else{ state.Calendar.now.ordinal = newordinal; } break; case 3: if(leap==0 &amp;&amp; ordinal &lt;= 60 &amp;&amp; newordinal &gt;= 60){ state.Calendar.now.ordinal = newordinal+1; }else{ state.Calendar.now.ordinal = newordinal; } if(newordinal&gt;366){ state.Calendar.now.ordinal=newordinal-366; state.Calendar.now.year = Number(state.Calendar.now.year)+1; } case 4: if(newordinal&gt;336){ state.Calendar.now.ordinal=newordinal-336; state.Calendar.now.year = Number(state.Calendar.now.year)+1; }else{ state.Calendar.now.ordinal = newordinal; } break; case 5: if(newordinal&gt;328){ state.Calendar.now.ordinal=newordinal-328; state.Calendar.now.year = Number(state.Calendar.now.year)+1; }else{ state.Calendar.now.ordinal = newordinal; } break; } }, addtime = function(addhours,addminutes){ if (state.Calendar.now.timetype === "OFF" || state.Calendar.now.timetype === "General"){ sendChat("Calendar","/w gm You must select the 24 hour clock to use the advance time function."); return; } var timecheck = state.Calendar.now.time; var currtime = state.Calendar.now.time.split(":"); var hour = currtime[0]; var minute = currtime[1]; var newminute = Number(minute) + Number(addminutes); var minhour = 0; while (newminute &gt; 60) { newminute = newminute - 60; minhour ++; } if (newminute &lt; 10) { newminute = '0' + newminute; } var newhour = Number(hour) + Number(addhours) + minhour; var day = 0; while (newhour &gt; 24) { newhour = newhour - 24; day ++; } if (newhour &lt; 10) { newhour = '0' + newhour; } if (day &gt; 0) { addday(day); weather(); } state.Calendar.now.time = newhour + ":" + newminute; }, getsuffix = function(day) { var date = day; var suffix; if (date == 'festival'){ suffix = ''; }else if (date == 1 || date == 21 ){ suffix = 'st'; }else if (date == 2 || date == 22){ suffix = 'nd'; }else if (date == 3 || date == 23){ suffix = 'rd'; }else{ suffix = 'th'; } return suffix; }, weather = function() { var roll; var temperature; var wind; var precipitation; var season; var ordinal = state.Calendar.now.ordinal; if(ordinal &gt; 349 || ordinal &lt;= 75){ season = 'Winter' }else if(ordinal &lt;= 166){ season = 'Spring' }else if(ordinal &lt;=257 ){ season = 'Summer' }else if(ordinal &lt;=349 ){ season = 'Fall' } roll = Math.floor(Math.random()*(20-1+1)+1); if(roll&gt;=15 &amp;&amp; roll&lt;=17){ switch(season) { case 'Winter': temperature = 'It is a bitterly cold winter day. '; break; case 'Spring': temperature = 'It is a cold spring day. '; break; case 'Summer': temperature = 'It is a cool summer day. '; break; case 'Fall': temperature = 'It is a cold fall day. '; break; } }else if(roll&gt;=18 &amp;&amp; roll&lt;=20){ switch(season) { case 'Winter': temperature = 'It is a warm winter day. '; break; case 'Spring': temperature = 'It is a hot spring day. '; break; case 'Summer': temperature = 'It is a blisteringly hot summer day. '; break; case 'Fall': temperature = 'It is a hot fall day. '; break; } }else{ switch(season) { case 'Winter': temperature = 'It is a cold winter day. '; break; case 'Spring': temperature = 'It is a mild spring day. '; break; case 'Summer': temperature = 'It is a hot summer day. '; break; case 'Fall': temperature = 'It is a mild fall day. '; break; } } roll = Math.floor(Math.random()*(20-1+1)+1); if(roll&gt;=15 &amp;&amp; roll&lt;=17){ wind='There is a light breeze and '; }else if(roll&gt;=18 &amp;&amp; roll&lt;=20){ wind='There is a howling wind and '; }else{ wind='The air is still and '; } roll = Math.floor(Math.random()*(20-1+1)+1); if(roll&gt;=15 &amp;&amp; roll&lt;=17){ precipitation="Light rain or snow."; if(season=='Winter'){ precipitation = 'snow falls softly on the ground.'; }else{ precipitation = 'a light rain falls from the sky.'; } }else if(roll&gt;=18 &amp;&amp; roll&lt;=20){ if(season=='Winter'){ precipitation = 'snow falls thick and fast from the sky.'; }else{ precipitation = 'a torrential rain begins to fall.'; } }else{ roll = randomInteger(2); if(roll==1){ precipitation = 'the sky is overcast.'; }else{ precipitation = 'the sky is clear.'; } } var forecast=temperature+wind+precipitation; state.Calendar.now.weather = forecast; }, getFaerunMoon = function() { var year = state.Calendar.now.year; var ordinal = state.Calendar.now.ordinal; var array; var moon; var remainder = year/4 - Math.floor(year/4); if(remainder==0.25) { array='array2'; }else if (remainder==0.5) { array='array3'; }else if (remainder==0.75) { array='array4'; }else if (remainder==0) { array='array1'; } var moonArray = getFaerunArray(array); var moonNO = moonArray.split(","); var moonImg = moonNO[ordinal]; var countStatement = ''; var full = moonNO[ordinal]; var counter = 0; var nextDay = Number(ordinal)+1; if (state.Calendar.now.mooncount == "ON") { while(full != 1){ if (nextDay &gt; 366){ nextDay-=366; if(array=='array1'){array='array2'}; if(array=='array2'){array='array3'}; if(array=='array3'){array='array4'}; if(array=='array4'){array='array1'}; moonArray = getFaerunArray(array); } moonNO = moonArray.split(","); full = moonNO[nextDay]; counter++; nextDay++; } countStatement = '&lt;tr&gt;&lt;td colspan="2" style = "border:none; padding: 5px;"&gt;Days until full moon: '+counter+'&lt;/td&gt;&lt;/tr&gt;'; } moon = '&lt;img src="'+getMoon(moonImg)+'" style="width:30px;height:30px;"&gt;&lt;/td&gt;&lt;/tr&gt;'+countStatement; return moon; }, getFaerunArray = function(array) { var moonArray; switch(array) { case 'array1': moonArray = '0,1,2,2,3,3,4,4,5,6,6,7,7,7,8,8,9,10,10,11,11,12,12,13,14,14,14,15,15,16,16,16,1,2,2,3,3,4,4,5,6,6,7,7,8,8,9,10,10,11,11,11,12,12,13,14,14,15,15,16,16,1,2,2,3,3,3,4,4,5,6,6,7,7,7,8,8,9,10,10,11,11,12,12,13,14,14,15,15,15,16,16,1,2,2,3,3,4,4,5,6,6,7,7,7,8,8,9,10,10,11,11,11,12,12,13,14,14,15,15,15,16,16,1,2,2,3,3,4,4,5,6,6,7,7,8,8,9,10,10,11,11,11,12,12,13,14,14,15,15,15,16,16,1,2,2,3,3,4,4,5,6,6,7,7,7,8,8,9,10,10,11,11,11,12,12,13,14,14,15,15,16,16,1,2,2,3,3,4,4,4,5,6,6,7,7,8,8,9,10,10,11,11,11,12,12,13,14,14,14,15,15,16,16,16,1,2,2,3,4,4,5,6,6,7,7,7,8,8,9,10,10,11,11,12,12,13,14,14,15,15,15,16,16,1,2,2,3,3,3,4,4,5,6,6,7,7,8,8,9,10,10,11,11,11,12,12,13,14,14,15,15,16,16,1,2,2,3,3,3,4,4,5,6,6,7,7,7,8,8,9,10,10,11,11,12,12,13,14,14,15,15,15,16,16,1,2,2,3,3,4,4,5,6,6,7,7,7,8,8,9,10,10,11,11,11,12,12,13,14,14,15,15,16,16,1,2,2,2,3,3,4,4,5,6,6,7,7,7,8,8,9,10,10,11,11,12,12,13,14,14,15,15,15,16,16,1'; break; case 'array2': moonArray = '0,2,2,3,3,4,4,5,6,6,7,7,7,8,8,9,10,10,11,11,11,12,12,13,14,14,15,15,16,16,1,2,2,3,3,3,4,4,5,6,6,7,7,8,8,9,10,10,11,11,11,12,12,13,14,14,15,15,15,16,16,1,2,2,3,3,4,4,5,6,6,7,7,7,8,8,9,10,10,11,11,12,12,13,14,14,15,15,15,16,16,1,2,2,3,3,3,4,4,5,6,6,7,7,8,8,9,10,10,11,11,11,12,12,13,14,14,14,15,15,16,16,16,1,2,2,3,4,4,5,6,6,7,7,7,8,8,9,10,10,11,11,12,12,13,14,14,15,15,15,16,16,1,2,2,3,3,3,4,4,5,6,6,7,7,8,8,9,10,10,11,11,11,12,12,13,14,14,15,15,16,16,1,2,2,3,3,3,4,4,5,6,6,7,7,7,8,8,9,10,10,11,11,12,12,13,14,14,14,15,15,16,16,16,0,1,2,2,3,4,4,5,6,6,7,7,7,8,8,9,10,10,11,11,11,12,12,13,14,14,15,15,16,16,1,2,2,3,3,3,4,4,5,6,6,7,7,8,8,9,10,10,11,11,11,12,12,13,14,14,14,15,15,16,16,16,1,2,2,3,4,4,5,6,6,7,7,7,8,8,9,10,10,11,11,11,12,12,13,14,14,15,15,16,16,1,2,2,3,3,3,4,4,5,6,6,7,7,8,8,9,10,10,11,11,11,12,12,13,14,14,14,15,15,16,16,16,1,2,2,3,4,4,5,6,6,7,7,7,8,8,9,10,10,11,11,12,12,13,14,14,15,15,15,16,16,1'; break; case 'array3': moonArray = '0,2,2,3,3,3,4,4,5,6,6,7,7,8,8,9,10,10,11,11,11,12,12,13,14,14,15,15,16,16,1,2,2,3,3,3,4,4,5,6,6,7,7,7,8,8,9,10,10,11,11,12,12,13,14,14,15,15,15,16,16,1,2,2,3,3,4,4,5,6,6,7,7,7,8,8,9,10,10,11,11,11,12,12,13,14,14,15,15,16,16,1,2,2,3,3,3,4,4,5,6,6,7,7,7,8,8,9,10,10,11,11,12,12,13,14,14,14,15,15,16,16,16,1,2,2,3,4,4,5,6,6,7,7,7,8,8,9,10,10,11,11,11,12,12,13,14,14,15,15,16,16,1,2,2,3,3,3,4,4,5,6,6,7,7,8,8,9,10,10,11,11,11,12,12,13,14,14,15,15,15,16,16,1,2,2,3,3,4,4,5,6,6,7,7,7,8,8,9,10,10,11,11,12,12,13,14,14,14,15,15,16,16,16,0,1,2,2,3,3,4,4,5,6,6,7,7,8,8,9,10,10,11,11,11,12,12,13,14,14,15,15,15,16,16,1,2,2,3,3,4,4,5,6,6,7,7,7,8,8,9,10,10,11,11,12,12,13,14,14,14,15,15,16,16,16,1,2,2,3,3,4,4,5,6,6,7,7,8,8,9,10,10,11,11,11,12,12,13,14,14,15,15,16,16,1,2,2,3,3,3,4,4,5,6,6,7,7,7,8,8,9,10,10,11,11,12,12,13,14,14,14,15,15,16,16,16,1,2,2,3,4,4,5,6,6,7,7,7,8,8,9,10,10,11,11,11,12,12,13,14,14,15,15,16,16,1'; break; case 'array4': moonArray = '0,2,2,3,3,3,4,4,5,6,6,7,7,8,8,9,10,10,11,11,11,12,12,13,14,14,14,15,15,16,16,16,1,2,2,3,4,4,5,6,6,7,7,7,8,8,9,10,10,11,11,11,12,12,13,14,14,15,15,16,16,1,2,2,3,3,3,4,4,5,6,6,7,7,8,8,9,10,10,11,11,11,12,12,13,14,14,15,15,15,16,16,1,2,2,3,3,4,4,5,6,6,7,7,7,8,8,9,10,10,11,11,12,12,13,14,14,14,15,15,16,16,16,1,2,2,3,3,4,4,5,6,6,7,7,8,8,9,10,10,11,11,11,12,12,13,14,14,15,15,16,16,1,2,2,2,3,3,4,4,5,6,6,7,7,7,8,8,9,10,10,11,11,12,12,13,14,14,15,15,15,16,16,1,2,2,3,3,4,4,5,6,6,7,7,7,8,8,9,10,10,11,11,11,12,12,13,14,14,15,15,15,16,16,0,1,2,2,3,3,4,4,5,6,6,7,7,7,8,8,9,10,10,11,11,12,12,13,14,14,15,15,15,16,16,1,2,2,3,3,4,4,5,6,6,7,7,7,8,8,9,10,10,11,11,11,12,12,13,14,14,15,15,15,16,16,1,2,2,3,3,4,4,5,6,6,7,7,8,8,9,10,10,11,11,11,12,12,13,14,14,15,15,15,16,16,1,2,2,3,3,4,4,5,6,6,7,7,7,8,8,9,10,10,11,11,12,12,13,14,14,14,15,15,16,16,16,1,2,2,3,3,4,4,5,6,6,7,7,8,8,9,10,10,11,11,11,12,12,13,14,14,15,15,15,16,16'; break; } return moonArray; }, getGreyhawkMoon = function() { var ordinal = Number(state.Calendar.now.ordinal); var lunaArray = '0,7,8,8,9,10,10,11,12,12,13,13,14,14,15,15,16,16,1,2,2,3,4,4,5,5,6,6,7,7,8,8,9,10,10,11,12,12,13,13,14,14,15,15,16,16,1,2,2,3,4,4,5,5,6,6,7,7,8,8,9,10,10,11,12,12,13,13,14,14,15,15,16,16,1,2,2,3,4,4,5,5,6,6,7,7,8,8,9,10,10,11,12,12,13,13,14,14,15,15,16,16,1,2,2,3,4,4,5,5,6,6,7,7,8,8,9,10,10,11,12,12,13,13,14,14,15,15,16,16,1,2,2,3,4,4,5,5,6,6,7,7,8,8,9,10,10,11,12,12,13,13,14,14,15,15,16,16,1,2,2,3,4,4,5,5,6,6,7,7,8,8,9,10,10,11,12,12,13,13,14,14,15,15,16,16,1,2,2,3,4,4,5,5,6,6,7,7,8,8,9,10,10,11,12,12,13,13,14,14,15,15,16,16,1,2,2,3,4,4,5,5,6,6,7,7,8,8,9,10,10,11,12,12,13,13,14,14,15,15,16,16,1,2,2,3,4,4,5,5,6,6,7,7,8,8,9,10,10,11,12,12,13,13,14,14,15,15,16,16,1,2,2,3,4,4,5,5,6,6,7,7,8,8,9,10,10,11,12,12,13,13,14,14,15,15,16,16,1,2,2,3,4,4,5,5,6,6,7,7,8,8,9,10,10,11,12,12,13,13,14,14,15,15,16,16,1,2,2,3,4,4,5,5,6,6,7,7,8,8,9,10,10,11,12,12,13,13,14,14,15,15,16,16,1,2,2,3,4,4,5,5,6,6,7'; var celeneArray = '0,16,16,16,1,2,2,2,2,2,2,2,3,3,3,3,3,3,3,4,4,4,4,4,4,4,5,6,6,6,6,6,6,6,7,7,7,7,7,7,7,8,8,8,8,8,8,8,9,9,10,10,10,10,10,10,10,11,11,11,11,11,11,11,12,12,12,12,12,12,12,12,13,14,14,14,14,14,14,14,15,15,15,15,15,15,15,16,16,16,16,16,16,16,16,1,2,2,2,2,2,2,2,3,3,3,3,3,3,3,4,4,4,4,4,4,4,5,6,6,6,6,6,6,6,7,7,7,7,7,7,7,8,8,8,8,8,8,8,9,9,10,10,10,10,10,10,10,11,11,11,11,11,11,11,12,12,12,12,12,12,12,12,13,14,14,14,14,14,14,14,15,15,15,15,15,15,15,16,16,16,16,16,16,16,16,1,2,2,2,2,2,2,2,3,3,3,3,3,3,3,4,4,4,4,4,4,4,5,6,6,6,6,6,6,6,7,7,7,7,7,7,7,8,8,8,8,8,8,8,9,9,10,10,10,10,10,10,10,11,11,11,11,11,11,11,12,12,12,12,12,12,12,12,13,14,14,14,14,14,14,14,15,15,15,15,15,15,15,16,16,16,16,16,16,16,16,1,2,2,2,2,2,2,2,3,3,3,3,3,3,3,4,4,4,4,4,4,4,5,6,6,6,6,6,6,6,7,7,7,7,7,7,7,8,8,8,8,8,8,8,9,9,10,10,10,10,10,10,10,11,11,11,11,11,11,11,12,12,12,12,12,12,12,12,13,14,14,14,14,14,14,14,15,15,15,15,15,15,15,16,16,16,16,16'; var lunaNO = lunaArray.split(","); var lunaImg = lunaNO[ordinal]; var Luna = getMoon(lunaImg); var celeneNO = celeneArray.split(","); var celeneImg = celeneNO[ordinal]; var Celene = getMoon(celeneImg); var moon = '&lt;img src="'+Luna+'" style="width:40px;height:40px;"&gt;&lt;img src="'+Celene+'" style="width:30px;height:30px;"&gt;&lt;/td&gt;&lt;/tr&gt;'; return moon; }, getMoon = function(moonNo) { var args = moonNo; var moon; switch(args) { case '1': // moon = 'Full Moon'; moon = '<a href="https://s3.amazonaws.com/files.d20.io/images/233667380/MBYOmrMyTJZwXOfKtaXi8A/original.png" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/233667380/MBYOmrMyTJZwXOfKtaXi8A/original.png</a>'; break; case '2': // moon = 'Waning Gibbous'; moon = '<a href="https://s3.amazonaws.com/files.d20.io/images/233667381/nbp3YjK1hC79k254XQpz-g/original.png" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/233667381/nbp3YjK1hC79k254XQpz-g/original.png</a>'; break; case '3': // moon = 'Waning Gibbous'; moon = '<a href="https://s3.amazonaws.com/files.d20.io/images/233667382/iPJ4-ZUT3m4o-7Yxek6dBg/original.png" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/233667382/iPJ4-ZUT3m4o-7Yxek6dBg/original.png</a>'; break; case '4': // moon = 'Waning Gibbous'; moon = '<a href="https://s3.amazonaws.com/files.d20.io/images/233667389/p-iUcWfcUiKGmOYJu1cryQ/original.png" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/233667389/p-iUcWfcUiKGmOYJu1cryQ/original.png</a>'; break; case '5': // moon = 'Last Quarter'; moon = '<a href="https://s3.amazonaws.com/files.d20.io/images/233667386/0IcEoGmVOGwDXHz3Ot8B0g/original.png" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/233667386/0IcEoGmVOGwDXHz3Ot8B0g/original.png</a>'; break; case '6': // moon = 'Waning Crescent'; moon = '<a href="https://s3.amazonaws.com/files.d20.io/images/233667388/6xUH3N9xwecO_vnqVqau9A/original.png" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/233667388/6xUH3N9xwecO_vnqVqau9A/original.png</a>'; break; case '7': // moon = 'Waning Crescent'; moon = '<a href="https://s3.amazonaws.com/files.d20.io/images/233667383/H6VRripBVJw1zBa59fGuDA/original.png" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/233667383/H6VRripBVJw1zBa59fGuDA/original.png</a>'; break; case '8': // moon = 'Waning Crescent'; moon = '<a href="https://s3.amazonaws.com/files.d20.io/images/233667387/3FSVm4LlOuXN-Je7EjHg6Q/original.png" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/233667387/3FSVm4LlOuXN-Je7EjHg6Q/original.png</a>'; break; case '9': // moon = 'New Moon'; moon = '<a href="https://s3.amazonaws.com/files.d20.io/images/233667385/zRlNhrS5Z4iL3fHHOFdJKg/original.png" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/233667385/zRlNhrS5Z4iL3fHHOFdJKg/original.png</a>'; break; case '10': // moon = 'Waxing Crescent'; moon = '<a href="https://s3.amazonaws.com/files.d20.io/images/233667397/GwFeC_2g-J-Ai27weqMmzA/original.png" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/233667397/GwFeC_2g-J-Ai27weqMmzA/original.png</a>'; break; case '11': // moon = 'Waxing Crescent'; moon = '<a href="https://s3.amazonaws.com/files.d20.io/images/233667384/q0gPYr4SBy9Ng5TjmYIA9Q/original.png" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/233667384/q0gPYr4SBy9Ng5TjmYIA9Q/original.png</a>'; break; case '12': // moon = 'Waxing Crescent'; moon = '<a href="https://s3.amazonaws.com/files.d20.io/images/233667394/zwM0EmbIhQfa-8SLLJpVaQ/original.png" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/233667394/zwM0EmbIhQfa-8SLLJpVaQ/original.png</a>'; break; case '13': // moon = 'First Quarter'; moon = '<a href="https://s3.amazonaws.com/files.d20.io/images/233667390/diYQY8TL4C9bjRrS0JTf5w/original.png" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/233667390/diYQY8TL4C9bjRrS0JTf5w/original.png</a>'; break; case '14': // moon = 'Waxing Gibbous'; moon = '<a href="https://s3.amazonaws.com/files.d20.io/images/233667391/iM0i_f8dA-c7SgyaOWJRZw/original.png" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/233667391/iM0i_f8dA-c7SgyaOWJRZw/original.png</a>'; break; case '15': // moon = 'Waxing Gibbous'; moon = '<a href="https://s3.amazonaws.com/files.d20.io/images/233667393/B-KmmwPsgJNFDp6yAhCYqg/original.png" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/233667393/B-KmmwPsgJNFDp6yAhCYqg/original.png</a>'; break; case '16': // moon = 'Waxing Gibbous'; moon = '<a href="https://s3.amazonaws.com/files.d20.io/images/233667395/7TxOWo-osspKVpZZwYSEYQ/original.png" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/233667395/7TxOWo-osspKVpZZwYSEYQ/original.png</a>'; break; } return moon; }, timemenu = function() { var timetype = state.Calendar.now.timetype; var timeselect = 'OFF'; switch(timetype) { case 'General': timeselect = '?{Time?|Morning (dawn)|Early Morning|Late Morning|Noon|Afternoon|Early Evening|Evening (dusk)|Late Evening|Midnight|After Midnight}'; break; case '24 Hour': timeselect = '?{Hour|01|02|03|04|05|06|07|08|09|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24},?{Minute|00,:00|15,:15|30,:30|45,:45}'; break; } return timeselect; }, createHandout = function() { var handout = createObj('handout',{ name: handoutName }); return handout; }, getHandout = function() { var handout = filterObjs(function(o){ return ( 'handout' === o.get('type') &amp;&amp; handoutName === o.get('name') &amp;&amp; false === o.get('archived')); })[0]; if(handout) { return handout; } return createHandout(); }, log = function(msg) { var args = msg.content.split(","); var text = args[2]; var addTime = args[1]; var handout = getHandout(); var nowdate; var ordinal = state.Calendar.now.ordinal; switch(Number(state.Calendar.now.world)) { case 1: nowdate = getFaerunDate(ordinal).split(','); break; case 2: nowdate = getGreyhawkDate(ordinal).split(','); break; case 3: nowdate = getModernDate(ordinal).split(','); break; case 4: nowdate = getEberronDate(ordinal).split(','); break; case 5: nowdate = getTalDate(ordinal).split(','); break; } var month = nowdate[0]; var day = nowdate[1]; var suffix = getsuffix(day); var year = state.Calendar.now.year; var date = day + suffix + " " + month + ", " + year; handout.get('notes', function(nts) { if(!_.isNull(nts)){ setTimeout(function(){ var newtext; if (addTime === "Yes"){ newtext = nts + "&lt;br&gt;" + date + " " + state.Calendar.now.time + " - " + text; } else { newtext = nts + "&lt;br&gt;" + date + " - " + text; } handout.set('notes', newtext); },0); } setTimeout(function(){},0); }); sendChat('Calendar','/w gm A new note has been added to the Events Log handout.'); }, checkInstall = function() { if(typeof state.Calendar == "undefined"){ setDefaults(); } if ( state.Calendar.now.version != version ){ checkDefaults(); } }, registerEventHandlers = function() { on('chat:message', handleInput); }; return { CheckInstall: checkInstall, RegisterEventHandlers: registerEventHandlers }; }()); on("ready",function(){ 'use strict'; Calendar.CheckInstall(); Calendar.RegisterEventHandlers(); });
1626705150
That works - thank you very much :)
1626708941
The Aaron
Forum Champion
API Scripter
No problem!