1. #1

    Fantasy Grounds Custom Calendar Tutorial

    I have seen a number of posts asking for help with creating custom calendars. I have tried to go through the forums and pull together all the gathered wisdom from many different posts and I have put together a custom calendar tutorial.

    The attached tutorial gives an overview of creating a calendar, covering both the XML definition within the module file, and the optional LUA code in an extension. I have included 6 working examples with their respective files and compiled modules/extensions. I have tried to provide some documentation within both the sample XML and LUA files to make things easy to understand. I would appreciate any comments or improvements.

    Also, huge credit goes out to user Andraax for all his calendar posts. A huge amount of what I learned was by going through those examples.

    Included Examples
    Example 1 - simple calendar, no holidays
    First sample calendar has only a mod file and no accompanying extension. This is because it is a very simple calendar requiring no additional calculations.
    Calendar basics
    The Example 1 calendar has
    7 months.
    Each month has 28 days (4 weeks)
    Each week has 7 days.
    So, due to the simple math, each month looks exactly the same as every other month. The first day of the Month is the first day of the the week. There are no leap years.

    Example 2
    The same calendar as Example 1 except with holidays added.

    Example 3
    Example Calendar 3 is a simple calendar consisting of 12 months. Odd months have 30 days, and even months have 31 days. There are no leap years.

    In order for FG to know what day of the week a month starts, an extension is included with the LUA code to calculate that.

    Example 4
    Example 3 is the default Gregorian calendar as defined in the CoreRPG with some code comments added in with explanations.

    The Gregorian calendar has months of varying length from 28-31 days, and has leap years. So the example includes the extension code which calculates both the day of the week properly, and calculates the number of days to add to the leap year.

    Example 5
    An excellent example calendar from a user on the FG forums

    Example 6
    A modified version of the traveller calendar, showing how to modify/format the day and date display
    Attached Files Attached Files
    Last edited by mattekure; March 8th, 2019 at 16:37. Reason: Updated attachment with new info

  2. #2
    damned's Avatar
    Join Date
    Mar 2011
    Blog Entries
    Great work mattekure

    MoreCore - Generic Ruleset
    --- Projects ---
    Extensions | Tutorials | MoreCore | MoreCore Themes | Call of Cthulhu | Maelstrom | FG Con

  3. #3
    Added a new example. The new example shows a modified version of the traveller calendar and demonstrates how you can modify how the calendar formats its day entries, and how you can change the formatting of the calendar date output to the chat.

Thread Information

Users Browsing this Thread

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

Posting Permissions

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

Log in

Log in