-
October 25th, 2021, 03:39 #101
Ok, I see what you mean. I took a look at your zip file, specifically the Faustacian Calendar.lua file and I think I see the issue. You are using a leap year system where it adds a day every 4 years. Your calcMyMonthVar() function does that correctly. However, your calcMyLunarDay() function does not take leap years into calculation. So when it is calculating what day of the week it is, it will start to go off for every leap year that has passed. In your screenshot its year 1632, which by your rule of every 4 years would mean adding 408 days for your calculation to be correct. So in your calcMyLunarDay() you would need to account for that by including something like
Code:function calcMyLunarDay(nYear, nMonth, nDay) local rYear = nYear * 365; local rMonth = nMonth-1; local rMonthDays = rMonth * 30; local rLeapDays = math.floor(nYear/4); local rDay = (rYear + rMonthDays + nDay+rLeapDays)%7; if rDay == 0 then return 7; end return rDay end
For support with any of my extensions, visit my #mattekure-stuff channel on Rob2e's discord https://discord.gg/rob2e
-
October 25th, 2021, 04:00 #102
- Join Date
- Jan 2017
- Posts
- 23
Thanks for looking into this! I went ahead and updated the calcMyLunarDay() function in the lua file, but I'm still getting the same issue with the 11th, 12th, and 13th of each month being displayed as "11st, 12nd, and 13rd" respectively. I've included the screenshot of the error and how it appears in my calendar as well as a zip containing the extension files in case I did something wrong replacing the code.
-
October 25th, 2021, 04:10 #103For support with any of my extensions, visit my #mattekure-stuff channel on Rob2e's discord https://discord.gg/rob2e
-
October 25th, 2021, 04:25 #104
- Join Date
- Jan 2017
- Posts
- 23
Sure!
-
October 25th, 2021, 14:28 #105
Ok, there is still a calculation issue. I'll post my edits in a little bit. But the error you are reporting with the 11, 12, and 13 is actually an error in CoreRPG calendar code. I will create a thread over on the FGU support forum to bring it to the devs attention.
EDIT: Error thread posted here https://www.fantasygrounds.com/forum...705#post624705Last edited by mattekure; October 25th, 2021 at 14:35.
For support with any of my extensions, visit my #mattekure-stuff channel on Rob2e's discord https://discord.gg/rob2e
-
October 25th, 2021, 14:54 #106
OK, I've fixed the calculation issue you were having. Its the primary reason the days of the week would not line up around your intercalary month. Here is the resulting function. The calculation you were missing was accounting for the fact that there was a month that didnt have 30 days, but you were calculating as if every month had 30 days. So during the year, if the date comes after the intercalary month, you need to subtract either 25 days, or 24 if its a leap year since that month is either 5 or 6 days long.
Code:function calcMyLunarDay(nYear, nMonth, nDay) local rYear = nYear * 365; local rMonth = nMonth-1; local rMonthDays = rMonth * 30; if nMonth >=8 then if nYear % 4 == 0 then rYear = rYear - 24 else rYear = rYear - 25; end end local rLeapDays = math.floor(nYear/4); local rDay = (rYear + rMonthDays + nDay+rLeapDays)%7; if rDay == 0 then return 7; end return rDay end
Last edited by mattekure; October 25th, 2021 at 15:42.
For support with any of my extensions, visit my #mattekure-stuff channel on Rob2e's discord https://discord.gg/rob2e
-
October 25th, 2021, 23:26 #107
- Join Date
- Jan 2017
- Posts
- 23
Thanks so much for the help!
-
October 28th, 2021, 03:45 #108
Okay, I accidentally deleted all of the OLD calendars while trying to add my custom one. Can anyone help me?
-
October 28th, 2021, 04:01 #109
The calendars are in a module file called calendars.mod
If you deleted that rerun the updater.
If you replaced it with your own version rename your file to something else and rerun teh updater.
-
January 12th, 2022, 19:56 #110
- Join Date
- Jan 2010
- Posts
- 2
This has been amazing and has allowed me to mostly model the imperial calendar for Warhammer Fantasy (crazy stuff with holidays not existing as days of the week or being numbered were ignored).
The one thing that I am trying to figure out now is if there is a way to change the formatting for multiple holidays falling on the same day. They are currently separated with a "/" and I would prefer that they are on different lines or separated with line breaks. Is this possible within the ext similar to how the date format can be changed? I have no idea how this would be accomplished.
Thread Information
Users Browsing this Thread
There are currently 4 users browsing this thread. (1 members and 3 guests)
Bookmarks