PDA

View Full Version : The best way to hide a calender month



DMFirmy
November 28th, 2014, 01:32
Hello everybody,

I have been tinkering around with implementing some custom functionality for my ruleset that relates to the calendar, and I am looking for some advice on the best way to handle the situation I currently find myself in. Within my ruleset, I have added the following line of code to my ruleset's initialization:


CalendarManager.registerMonthVarHandler("theon",calcTheonMonthVar);

For the calcTheonMonthVar function, this is the code that is used:


function calcTheonMonthVar(nYear, nMonth)
if nMonth == 13 then
nYear = DB.getValue("calendar.current.year", 0);
if (nYear % yearsInAnAge) == yearsInAnAge - 1 then
return 0;
else
return -1;
end
end
return 0;
end

This code looks at the current month, and if it is the 13'th month it checks to see if this year is the year then ends the current "age". Unless it is, the -1 result that is returned from this function will subtract the only day that is defined for the 13'th month in my calendar module. Here is the XML definition:


<period13>
<days type="number">1</days>
<holidays>
<holiday1>
<duration type="number">1</duration>
<name type="string">Aeon Day</name>
<startday type="number">1</startday>
</holiday1>
</holidays>
<name type="string">Aeon Day</name>
</period13>

This functionality works really well as it is, with all years except the desired one showing the "Aeon Day" month as empty, as in this screenshot:
8138
And now to my question... Without having to override all the calendar base functionality and windows, how would I go about hiding the empty month from the calendar display altogether? I did some experimenting and got it to work, but I wound up having to overwrite several XML and Lua files from the CoreRPG ruleset, and I would like to avoid doing this if possible. As always, any help or advice is appreciated.

damned
November 28th, 2014, 01:55
you copy those files that you overwrote into your extension, include them in the base.xml
you can probably include only your changed code in these files.