5E Product Walkthrough Playlist
  1. #1

    The best way to hide a calender month

    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:
    Code:
    CalendarManager.registerMonthVarHandler("theon",calcTheonMonthVar);
    For the calcTheonMonthVar function, this is the code that is used:
    Code:
    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:
    Code:
    <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:
    Attachment 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.

  2. #2
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,685
    Blog Entries
    1
    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.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
DICE PACKS BUNDLE

Log in

Log in