View Full Version : Forbidden Lands Calendar module

March 2nd, 2019, 19:01
I created simple calendar module for Forbidden Lands for the adventure I will run next week. It is based on the calendar of the humans as stated on page 35 of Gamemaster's Guide. Because the section is not verbose enough for those who are calendar freaks (I am not), I made the following decisions:

The festivals that divide the phases are on the 1st of the respective month that they precede
There is no information on the days in a week so I took 7 days per week.
The name of the week days are taken from Pathfinder. I think they sound quite appropriate for the setting

Below is the module, the extension and a screenshot. If you think this can be approved to be more in tone with the setting let me know.

2019-Mar-02: The .mod file updated with periods of 45 days. Added .ext file specific for calculating the start of each month, specific for Ravenlandian calendar
2019-Mar-04: Uploaded the final version of the calendar v1.0 with 45 days in period, announcement text and FL logo reference upon loading.

March 2nd, 2019, 19:13
Looks like the ending days of one month do not match up to the beginning days of the following month.

March 2nd, 2019, 19:23
Indeed there is some mismatch on the day one month ends and the other begins. Probably due to the use of the gregorian tag. Have to check what else I can do to alight the days.

March 2nd, 2019, 19:40
The reason your calendars dont line up the days is because you do not have an extension with the necessary LUA code. Check out the tutorial here https://www.fantasygrounds.com/forums/showthread.php?47885-Fantasy-Grounds-Custom-Calendar-Tutorial

using the gregorian tag means it is trying to use the logic of the gregorian calendar to wrap the days, but that logic doesnt align with how your calendar is defined. You need to write your own function in order to make them wrap properly.

Does your calendar have leap years?

March 2nd, 2019, 19:56
Yes, I figured I have to make my own extension for this calendar. I didn't find this thread and I really thank you for having detailed tutorial one. I am going to explore it as soon as possible tomorrow.

So far I modified the calendar file to use ravenlandian instead gregorian and based on what I have researched so far there is function that is handling months with variable lengths and want to see if it will work for me. (CalendarManager.registerMonthVarHandler)

The calendar information for the setting is very brief, so in short:

No leap year
Different number of days in each month
Counting starts from Year 0 where there is events called "The Shift". If 0 is problematic for the calculations then Year 1 is from where all counting starts, Day 1 of of the first month (because it is easy and there is no other setting information)

March 2nd, 2019, 21:25
The LUA code you are looking for will look something like this:

function onInit()
CalendarManager.registerLunarDayHandler("Forbidden_Lands", Forbidden_LandsLunarDay);

function Forbidden_LandsLunarDay(nYear, nMonth, nDay)
local rMonth = nMonth -1;
local rMonthDays = 0;
if nMonth < 3 then
rMonthDays = rMonth*45;
if nMonth > 2 then
rMonthDays = 90 + ((nMonth-3)*46);
if nMonth > 7 then
rMonthDays = rMonthDays -1;
local rDay = (rMonthDays + nDay)%7;
if rDay == 0 then
return 7;
return rDay;

I've attached a working calendar module and extension you can take a look at.

March 2nd, 2019, 21:28
Amazing, mattekure! :)

I will check this out and update the main post! I decided to stop at months with 45 days as I couldn't figure proper formula to tackle the 46 days months yet.

March 2nd, 2019, 21:45
the calendar is nice in that there is no drift, year to year it looks the exact same. thats because it has 364 days, an exact multiple of the number of days in a week (7).

The 45 vs 46 days I just accounted for with a few if statements. ie
If the month is less than 3 (1 or 2), then its month-1 times 45 days. so month 1 would return 0, and month 2 would return 45.

If the month is greater than 2, I add 90 (months 1 & 2) and then multiply the month-3 by 46. so month 3 would be 90+0*46. month 4 would be 90+1*46, etc. this is accurate for all the rest of the months except for month 7. that has one less day, so I check if the month is 8, and subtract one day from the previous calculation.

March 4th, 2019, 08:49
The formula indeed works but the decision to have half the months with 46 day resulted in a unexpected configuration - the start/end of month/year is always the same, which makes the whole calendar very static and I don't like it. I want the dates to shift so I ended up with 45 days per month.

Because there is no information under what circumstances there are 46 days in month and the possibilities I will leave it here for now. It works and helps for the immersion during play :)