-
August 18th, 2022, 20:25 #151
i was thinking about creating an excel macro that would auto create the code for copy and pasting in to the mod files, if any one is interested in this let me know
-
August 18th, 2022, 21:08 #152
Problems? See; How to Report Issues, Bugs & Problems
On Licensing & Distributing Community Content
Community Contributions: Gemstones, 5E Quick Ref Decal, Adventure Module Creation, Dungeon Trinkets, Balance Disturbed, Dungeon Room Descriptions
Note, I am not a SmiteWorks employee or representative, I'm just a user like you.
-
August 22nd, 2022, 16:47 #153
- Join Date
- Apr 2020
- Posts
- 105
Grrrr!
I had to reload CoreRPG.pak due to some corruption and it messed my calendar up! ARG!!!
I had notes on every step except one, which to my shame, I forgot to log as it was the last thing I figured out, the weekday.
I got everything, well almost everything back to normal, but for some reason only two of my days show up properly now like in this photo:
Capture 1.PNG
The other five days are showing up as such:
Capture 3.PNG
Here is my code from the mod file for the names of the weekdays:
<lunardaycalc type="string">Twilight</lunardaycalc>
<lunarweek>
<day1 type="string">Resdor</day1>
<day2 type="string">Sendor</day2>
<day3 type="string">K'zyldor</day3>
<day4 type="string">Mildor</day4>
<day5 type="string">T'yandor</day5>
<day6 type="string">Freldor</day6>
<day7 type="string">Cel'myrdor</day7>
</lunarweek>
Note: Only days six and seven are showing up.
Here is the function block from the manager_calendar.lau from the CoreRPG.pak file function that I customized:
function getDateString(sEpoch, nYear, nMonth, nDay, bAddWeekDay, bShortOutput)
local sDateFormat = DB.getValue("calendar.data.dateformat");
if sDateFormat and aDateDisplay[sDateFormat] then
return aDateDisplay[sDateFormat](sEpoch, nYear, nMonth, nDay, bAddWeekDay, bShortOutput);
end
local sMonth = CalendarManager.getMonthName(nMonth);
local sDay = StringManager.ordinalize(nDay);
local sOutput;
if bShortOutput or (nYear == 0) then
sOutput = sDay .. " " .. sMonth;
--*************************************************--
-- This is where I am testing my custom variable! --
--*************************************************--
else
sOutput = " the "..sDay .. " day of " .. sMonth .. ", Year " .. nYear .. ", Era of " .. sEpoch;
end
if bAddWeekDay then
local nWeekDay = CalendarManager.getLunarDay(nYear, nMonth, nDay);
local sWeekDay = CalendarManager.getLunarDayName(nWeekDay);
sOutput = sWeekDay .. ", " .. sOutput;
end
return sOutput;
end
Any help would be most appreciated!
ChipDancer
-
August 22nd, 2022, 22:29 #154
Please try with the ' in the names?
Also please dont edit CoreRPG.pak - this file gets regularly updated - you should make your calendar in a mod/ext.
-
August 23rd, 2022, 02:05 #155
I'll echo what Damned said. Never edit the corerpg.pak directly. it gets updated and will wipe out whatever you do. Instead, create an extension for your code and register it. In your code, you can set up your custom handlers by using the following functions.
CalendarManager.registerLunarDayHandler() - used to override the default behavior of calculating what day of the week it is: used instead of getLunarDay()
CalendarManager.registerMonthVarHandler() - used to override the default behavior of how many days in a month: used instead of getDaysInMonth()
CalendarManager.registerDayDisplayHandler() - Used to override the default behavior of how to format the day value: used instead of getDayString()
CalendarManager.registerDateDisplayHandler() - used to override the default behavior of how to format the date string: used instead of getDateString()Last edited by mattekure; August 23rd, 2022 at 02:09.
For support with any of my extensions, visit my #mattekure-stuff channel on Rob2e's discord https://discord.gg/rob2e
-
August 23rd, 2022, 15:20 #156
- Join Date
- Apr 2020
- Posts
- 105
Calendar still broken...
Mattekure,
I hate to bother you, but could you please take a look at my calendar mod for me? I simply cannot see what was changed and I'm betting it's something stupid, but I'm not seeing any code errors that are obvious. I would be most appreciated.
ChipDancer
-
August 23rd, 2022, 17:16 #157For support with any of my extensions, visit my #mattekure-stuff channel on Rob2e's discord https://discord.gg/rob2e
-
August 23rd, 2022, 18:07 #158
The only issue I observed was in the extension itself, and likely stems from not understanding the purpose of the function. The LunarDayHandler that is registered is designed to return a number representing the day of the week, with 1 being the first day of the week. By default, the calendar starts at Year 0, Day 1 which is set on the first day of the week. In order to properly calculate what day of the week Thursday, May 5, 2082 falls on, we run through a series of calculations to sum up all the days from year 0 day 1, to the targeted date. See comments in code below
Code:function calcTwilightLunarDay(nYear, nMonth, nDay) local rYear = nYear * 362; -- Since we know that every year contains 362 days on this calendar, we can calculate the total number of days since year 0 by multiplying the current year by 362. That gives us the number of days up to the first day of the current year. local arrayMonthDays = {0,28,58,89,120,150,178,209,239,269,300,331,362}; -- you do not need the last entry 362 as that number will never be reached. if you ever hit it, you would be restarting at a new year at 0. -- These next three lines are not needed. if (nMonth == 0) then nMonth = 1; --sets current month? end -- We use the nMonth variable as an indices to the arrayMonthDays table to determine the number of days that have occurred up to the current month. local rMonthDays = arrayMonthDays[nMonth]; -- The following line calculates the total number of days since Year 0 Day 1. It has rYear and rMonthDays calculated above, which are the number of days up to the first of the current month, and nDay which is the day of the current month. Adding them all together gives us the total number of days. The week is exactly 7 days long, and starts on day 0. So we use the modulus operator to get a number 0-N which represents the day of the week. This does not have anything to do with spacing. local rDay = (rYear + rMonthDays + nDay)%7; --not sure what this does yet, but looks to control vertial column spacing ??? -- The following is incorrect because you are adding additional days beyond the week definition of 7. with this code, The first day of the month would fall on the 7th day of the week, and so on. So you end up with weird blank weeks. return (rDay+6); --sets start day of the year end
Code:function calcTwilightLunarDay(nYear, nMonth, nDay) local rYear = nYear * 362; -- Calculate the total number of days from Year 0 to First day of current year. local arrayMonthDays = {0,28,58,89,120,150,178,209,239,269,300,331}; -- index to lookup number of days passed this year up to the current month, but not including the current month. local rMonthDays = arrayMonthDays[nMonth]; -- lookup the number of days passed in the current year up to the current month. local rDay = (rYear + rMonthDays + nDay)%7; -- Add up all the days from the years, months, and days of the current month to get the grand total number of days from Year 0 Day 1 to Current Year/Month/Day. Use the % operator to divide the total number of days by the number of days in a week if rDay == 0 then rDay = 7 -- this ensures that we are working with day of the week values from 1-7 and not 0-6. In this instance, a modulus of 0 means that it is the exact number of days in a week, so represents the last day of the week. end return rDay; -- return the value 1-7 of which day of the week that the date specified in nYear/nMonth/nDay should fall on. end
Last edited by mattekure; August 23rd, 2022 at 21:22.
For support with any of my extensions, visit my #mattekure-stuff channel on Rob2e's discord https://discord.gg/rob2e
-
August 23rd, 2022, 19:30 #159
- Join Date
- Apr 2020
- Posts
- 105
You sir rock!
Thank you so very much for pointing that out as I had been focused on thinking it was the mod file! LOL!!!
(^_^)
'bows low'
ChipDancer
-
August 26th, 2022, 21:28 #160
- Join Date
- Apr 2020
- Posts
- 105
Anyone see or know of any weather mods/exts that could be used with the Calendar?
I was rereading one of the posts in this thread and thought wouldn't it be interesting if there was a mod/ext for generating weather with your calendar. Anyone know if such exists?
Thanks in advance,
ChipDancer
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks