Advertisement Create a free account

[Script] Faerun Calender and Down Day Counter

1488471343

Edited 1488550943
Kirsty
Pro
Sheet Author
I needed a way to keep track of the down days my players earn as they travel, so I wrote up a little script. Maybe it can be of use to someone else! Please note, this will only work with the OGL sheet. If other people actually want to use this, I'd be willing to adjust it. This is my first foray into writing api scripts so I wanted to share it! :D EDIT: Version 2.1 now works with any character sheet. GitHub Repository Typing !cal as a GM will bring up the menu: You can adjust the any of the settings by clicking on the buttons. Ordinal = The number of the date between 1 and 365. Down Day Divider = Divisor for the number of down days available to players. For example, you might want to assign 1 down day for every 2 days in game. Advance the Date = Is your parting travelling for 24 days to get to Waterdeep? Click on "Advance the Date" and the new day and month will be calculated along with the number of down days earned. Roll Weather = The weather rolls automatically whenever the date is advanced using the rules from the 5th edition DMG. If you don't like the weather that day, roll again! When a player types !cal into the chat or when the DM clicks on "Show to Players" the player view of the calendar is shown:
1488471405
The Aaron
Forum Champion
API Scripter
Nice! =D
1488471614
Kirsty
Pro
Sheet Author
Thanks! I spent a lot of time staring at your code to figure out how name spaces and state variables worked!
1488472568
The Aaron
Forum Champion
API Scripter
Me too, me too!
Thanks for this great script! I'm using it for my campaign and it is already really helpful. Instead of using the down days, I'm using it as a countdown/time tracker. I've traded the text out in the script so it reports "It has been X days since calendar reset." My group is currently on a timed mission, so having something in game they can pull up at will that is easy for me to update is fantastic.
1488514467

Edited 1488514529
Kirsty
Pro
Sheet Author
That's a great use for this script! I cannot tell you how happy I am that it's actually being used by someone.  You made  my day!
Looks nice.  Why does it only work with OGL?  Just because the chat format matches it?
1488540830

Edited 1488540862
Kirsty
Pro
Sheet Author
Ya, it uses the template from the ogl sheet. It wouldn't be a big deal to alter it if shaped sheet users want to use it.
Yes please!  :)
1488551051
Kirsty
Pro
Sheet Author
Version 2.1 is sheet independent. Please let me know if you have any problems.
1488572815
Thorsten
KS Backer
Love it, this is great!
1488573143
Kirsty
Pro
Sheet Author
Glad you like it! :D
Using 2.1, I don't seem to be able to set the month to 'Tarsakh' from the chat.  I can set it to 'Ches' and then advance the days by 30, but it doesn't seem to accept setting the month to Tarsakh.  I've set the year to 1385, don't know if that has anything to do with it.
1488660517
Kirsty
Pro
Sheet Author
Thanks for the bug report! It appears that I cannot spell 'Tarsakh', which is what caused the problem. It is fixed in  version 2.2 .
Yep, working now.  Nice!
1488706441

Edited 1488706481
Is there a way to set the GM menu to be "whisper only"? Awesome API by the way, so much more simple to use then some other one I found a while back.
1488728471

Edited 1488728482
This is fantasitc. I've been meaning to try and do something like this. Also, please consider adding moon cycles in the future.
1488826809
Kirsty
Pro
Sheet Author
Sorry for the slow response guys, the flu has gotten the better of me. @Firepants The menu was supposed to be whispered, but I took it off for a test and forgot to put it back on. It has been fixed in  v.2.3 . @Andrew I'm glad you like it! I have actually been working on adding moon cycles. Would you prefer a more traditional calendar showing the whole month, or would you just like a description/image of Selune below the weather?
1489085996

Edited 1489086174
Hey this is great!  I was easily able to edit it for use with the Greyhawk Calendar.  I was just thinking of a way to try and add moon phases to it myself to track Oerth's two moons :D   My two cents about the moon, I was thinking of trying a description with an image if I ever find the time T.T
1489514469
Goat Games
Pro
Marketplace Creator
Might sound very mundane, but would it be possible to edit this for a regular nowadays calendar? I would really like to keep track of days with something like that in my Sci-Fi game.
1489522299

Edited 1489522314
Kirsty
Pro
Sheet Author
@ Snek King  Here you go! I've been working on the phases of the moon, so there will be an update on the Faerun calendar very soon! I've also got a Greyhawk version that I made for a friend that I will be adding moons to as well.
1489538645
Awesome one! What is Down Days btw?
1489550717
Kirsty
Pro
Sheet Author
In Adventurer's League games, down days can be used to learn a skill, earn money at a job or proficiency with a new weapon. In my games, I award down days for each day in the game world. In the next revision of the calendar, there is the option to turn the down day counter off if you aren't using that particular mechanic. 
1489551579
Sky
Pro
I suggest making the css for the inline rolls on the days, month, etc all the same width.
1489555512
Kirsty
Pro
Sheet Author
You are sooooo right. Javascript I can learn, but making things pretty is completely beyond me. And now it's really bugging me that none of the buttons are the same size.
If you're looking for suggestions on features, the ability to set event reminders to go off in the future would be a great boon.
1489557425
Kirsty
Pro
Sheet Author
Hmm, that could be doable. I'll see what I can do.
1489585245
Kirsty
Pro
Sheet Author
Thanks to  Brusana , there is now a Greyhawk version of the calendar with moon cycles! Faerun and Modern moons coming soon!
1489589609
Kirsty said: In Adventurer's League games, down days can be used to learn a skill, earn money at a job or proficiency with a new weapon. In my games, I award down days for each day in the game world. In the next revision of the calendar, there is the option to turn the down day counter off if you aren't using that particular mechanic.  Ooh gotcha! Thx.
1489842664

Edited 1489842757
Oh man so next revision will have moon cycles and ability to turn off downtime days? Just bought Yawning portal so my hype is shifting into your direction Kirsty! Maybie sometime in the future once you get the important stuff out the way, an ability to see when you started counting days? some output on how long the campaign is going on for.
1489951630
Kirsty
Pro
Sheet Author
Yet another  update has been done to the Faerun version of the calendar.  Button width has been altered. Moon cycles have been added. For now this is just text. If the down day divider is set to 0, down days will not be added automatically when the date is advanced. This gives GMs the option of manually adding down days. If the number of down days are set 0, they will not be shown in the player view of the calendar. Upcoming changes (these are still in the works) Consolidate all three calendars into one script - that way when a change is made, it happens for all three versions at once. Leap years Add "campaign start date", with campaign length counter Add the ability to set event reminders Pictorial version of the moon phases to go with the text I really appreciate all of the feedback. Please keep your suggestions and comments coming!
I have just added your script, looks good, although I'm setting my current campaign in 1400 and the moon cycle is out by about 5 days.  I assume this is because you have yet to add leap years?
1489955941
Kirsty
Pro
Sheet Author
Yes, Jim, unfortunately that's correct. I'm hoping to get it sorted out very soon - by next weekend at the latest. I need to get all three calendars amalgamated before I go too much further. I want to get everything streamlined so that I don't have to re-write the same chunk of code three times. I will make the leap year/moons a priority once the calendars are combined. :)
Hi. Our DM really likes this script but had a few suggestions/requests. I thought I would put them here to see if you can support them. Can you make it so it tracks the time of day too? It could be as easy as morning, noon, afternoon, evening, etc or it could be down to the hour. Can you allow the DM to input the weather instead of randomizing? Can you log the days in a journal/handout? Maybe all the information you show the players and then the in real life actual date and time maybe as some sort of player's log? Great fun this script. Thanks for the work and sharing it.
1490452229
This is a very cool script!
1490452666
Kirsty
Pro
Sheet Author
I just wanted to post a little update. I'm working on the amalgamated script but real-life has reared it's ugly head. I'm still trying to have it up for tomorrow evening, but there may be a delay. The good news is that I'm incorporating several of the suggestions here. The next update is going to be a BIG one! @HLazer Thank you for the suggestions! Both time of day and allowing the GM to edit the weather are quite easy to incorporate and will be included in the next update. (I've been thinking that the weather needed editing for a while). Can you give me an example of what kind of output you would like for a log? It's definitely something I can look into incorporating. @Chris Thank you! I'm so happy that people are using it!
Thanks for the update @Kirsty. Talked with my GM and he did not really have any further comments about format for the journal. So maybe consider that a long term idea and go ahead with your short term changes. regards, H
1490629869
Thorsten
KS Backer
The Moon Phases calculation is off. More on moon phases under (*). I'm at 16 Hammer 1485, moon is waning (!) gibbeous. Go forward 5 days in one adjustment, to 21 Hammer 1485, and moon is full. From waxing gibbeous to full in 5 days, yes. From full to waning gibbeous in 5 days, yes. From waning gibbeous to full in 5 days ... not unless the moon cycles through phases in under 5 days :). Moon phases for reference, in order: Waxing Crescent First Quarter Waxing Gibbous Full Moon Waning Gibbous Last Quarter Waning Crescent New Moon Love the script! Thanks so much for putting this together! (*) And Faerun moon nerdery from the wiki. Looks like it's close to earth-like, but with a slightly more "orderly" progression of the phase in relation to the orbit of its parent. This actually makes for easier calculations. I don't know how or whether the spellplague affected the phases of the moon at all. Selûne was full at midnight on Hammer 1, 1372 DR , and subsequently every 30 days, 10 hours, and 30 minutes. Selûne was also full at midnight on the first day of every leap year. Selûne made exactly 48 synodic revolutions every four years, so the phase of Selûne was the same at the same time on the same date every four years. Selûne was generally full around the first day of each month, give or take a day; festival days served to keep the moon's phases consistent across calendar months and years.
1490630289

Edited 1490630867
Thorsten B. said: Selûne was full at midnight on Hammer 1, 1372 DR , Looks like you're using the same calendar tool that I use - makes sense.  Do we have any info on what time of day the moon is visible in the sky on any given day?
1490717241
Kirsty
Pro
Sheet Author
Well, this is taking way longer than I had hoped! The scripts are combined and I've got the leap years working. I've also added a bunch of the suggestions from this thread. I know I promised revisions shortly, but I'm afraid it's going to take longer than I had hoped. Please bear with me while I get everything included. The reason I'm trying to do one big update rather than lots of little ones is that I'm hoping to get the newest update added to the Roll20 dropdown. This means that you will no longer have to manually update the script every time a change is made that you want to use. Thank you for your patience everyone! @Thorston Thanks so much for the info, it was really helpful. I did use the wiki page to get the moon cycles figured out, but as you saw, I didn't put the moon cycle in the right order, which, combined with a lack of leap years, has caused havoc!  @HLazer I've been thinking about a handout, and it might work well with one of the suggestions above to add event reminders. I'll definitely keep it in mind and if you or your DM have any further thoughts on it, please let me know.
Kirsty said: The reason I'm trying to do one big update rather than lots of little ones is that I'm hoping to get the newest update added to the Roll20 dropdown. This means that you will no longer have to manually update the script every time a change is made that you want to use. Thank you for your patience everyone! @HLazer I've been thinking about a handout, and it might work well with one of the suggestions above to add event reminders. I'll definitely keep it in mind and if you or your DM have any further thoughts on it, please let me know. Thanks for both of these! Happy coding. H
1491227920
Kirsty
Pro
Sheet Author
Calendar version 3.0 is out! Supports Greyhawk, Eberron, Faerun and Modern settings Leap years are included! Moon-cycles are included for Greyhawk and Faerun (I corrected the issue with the Faerun moons - thanks to Thorsten for the help!) There is a "time" option to add the time of day - at the moment this is just a text field but I'm open to suggestions A field has been added for the campaign start date Weather can be either rolled or edited manually Setting down days to 0 will remove them from the player's version of the calendar Setting down day divider to 0 will prevent down days from being added automatically I will be submitting the calendar to the one click install shortly, but I wanted to get the changes out for those of your who had requested them.
Looks good, two issues to report: 1. Maybe this isn't an issue, but I'm not seeing an image for the moon, just a description of the cycle (don't know if you intended to show an image or not) 2. When I set down days to "0" and down day divider to "0" then advance the date by a day, it still accumulates a down day. Thanks for all your hard work on this!
1491236327
Kirsty
Pro
Sheet Author
Thanks for the report Gozer.  The moons showing a text field is correct, though images will be coming soon. The down day counter does not seem to be functioning correctly though. I'll have a look this afternoon. 
1491237509

Edited 1491245757
Love this update, but I noticed that Celene gets to "New" and "Full" an ordinal early Edit: The logic tomorrow<today causes the moons to arrive at full an ordinal early and spend 2 ordinals at full.  I don't know if this is intended or not.  Sorry it does not arrive at new an ordinal early. Edit, Edit: Additionally the Faerun Calendar is currently the only one to tick over at the end of the year it looks like, and when you go over the ordinal limit in the Greyhawk or Modern case (haven't tested Ebberron) the Calendar goes back to the 1st Ordinal Date, but the date wont advance if you add days
Suggestions for time: Early Morning Morning (dawn) Late Morning Noon Afternoon Early Evening Evening (dusk) Late Evening Midnight After Midnight H
1491248982
Kirsty
Pro
Sheet Author
@Gozer I found the down day issue, update will be coming tomorrow. @Brusana Thank you for the report. I'll have a look at it. I appreciate you going into the code and finding the issue! @HLAZER I'll add it to tomorrow's update. I really can't thank you guys enough for all of the error checking and bug reports. Seriously, you're the best.
1491314312

Edited 1491508513
No problem Krusty I'm glad to help out.  In terms of the second issue I reported it looks like the Ordinal isn't getting reset like it is in the Faerun case when the year ticks over (lines ~855-883). Edit: As a thought for the weather, it might be good to let us set the starts of the seasons, or make those world specific.  Oerth has 2 summers that consume most of the year >.<.  Or rather one big summer that is split into Low Summer and High Summer.  But they're back to back. Edit:  Also I don't know how hard it is to include with the multiple worlds, but the function of !setordinal was useful for debugging.  Though it is not -really- needed for release versions. Edit: I feel a bit foolish that I didn't notice that the ordinal display was simply commented out. More Edits:  Also I noticed that Celene does come to the New phase a day early.  I explored the logic and it its because the 91 day cycle makes the logic (today<=0.5 && tomorrow>0.5) not good so I suggest you change Celene's percentage calculation to the following:         today = Math.floor((CeleneOrd/91 - Math.floor(CeleneOrd/91))*100)/100;         tomorrow = Math.floor(((CeleneOrd+1)/91 - Math.floor((CeleneOrd+1)/91))*100)/100; Another Edit, because double posting is the devil:  Also for the Greyhawk Calendar Readyreat should be Ready'reat.  At the time I made those changes I didn't know that \ would stop the code from ending the string.
1493497030
Mik Holmes
Pro
Marketplace Creator
This is amazing! Thank you! Was there an update to the down day issue? I'm still having it increment when increment is 0.
1493562943
Kirsty
Pro
Sheet Author
Wow, this script really got away from me.... I did fix the down day issue, as well as the problem with the years not ticking over. The times suggested by HLazer have also been included.  Version 3.0.1 There is a bit of a problem at the moment with the Modern Calendar not accounting for leap years correctly and I haven't implemented Brusana's moon fix yet, though that should only be affecting the Greyhawk side of things.
1493615323
Added the script and getting errors 5e OGL TypeError: Cannot read property 'now' of undefined TypeError: Cannot read property 'now' of undefined at Object.checkInstall [as CheckInstall] (apiscript.js:6986:29) at apiscript.js:7008:11 at eval (eval at <anonymous> (/home/node/d20-api-server/api.js:146:1), <anonymous>:65:16) at Object.publish (eval at <anonymous> (/home/node/d20-api-server/api.js:146:1), <anonymous>:70:8) at checkForReady (/home/node/d20-api-server/api.js:1314:12) at /home/node/d20-api-server/api.js:1394:9 at c (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:14:64) at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:560 at hc (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:39:147) at Kd (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:546)