PDA

View Full Version : Calendar modules documentation?



Blacky
January 16th, 2014, 19:21
Is there some documentation about the calendar xml tags? Some things are almost self explanatory, but others (like what's a non-static base… some king of malted beverage?) aren't.

Also, is there a way to compute dates? The most obvious usage would be to place the Easter holiday on the calendar.

And last, any way to translate the module without rewriting it altogether?

Edit: well in any case, the lua script is choke full of English-ism about dates. Can't be used as is, rewrite seems necessary.

Moon Wizard
January 17th, 2014, 19:15
The calendar.base.<name> path is where the calendar "meta-information" is stored in the module. This is copied into the campaign at calendar.data when a calendar is selected.

name = Name of calendar displayed in calendar selection screen
setting = Setting info of calendar displayed in calendar selection screen

lunarweek.day# = Name of each day of the lunar week
lunardaycalc = Registered name of function that translates year/month/day to lunar week day

periods.period#.name= Name of each month
periods.period#.days= Number of days in each month
periodvarcalc = Registered name of function that returns modification of days in month based on year/month

periods.period#.holidays.holiday#.name = Name of a holiday in the month
periods.period#.holidays.holiday#.startday = First numerical day of a holiday in the month
periods.period#.holidays.holiday#.duration = Number of days of duration of a holiday in the month

There are many assumptions in the calendar in order to make it reasonable to code, including year/month/day/hour/minute as units of time, 24 hour days, 60 minute hours, holidays start on a fixed day of the year, holiday duration does not span month boundaries.

For output,
the data format is <lunar day>, #<suffix> <month>, <year> <epoch>
the time format is <hour12>:<minutes> <AM/PM>

Other than the suffix, what other English-isms are you referring to?

JPG

Blacky
January 17th, 2014, 20:00
Thanks for the data!

Although… what's an “epoch”? I know what it is, but what's the possible use in this type of calendars?


Other than the suffix, what other English-isms are you referring to?JPG

Sunday as the first day of the week seems the biggest one
Month first, then #day, and commas everywhere
AM/PM notation
Time notation (hh:mm)
And in the output, the strings “The time is” and “The date is”

I think that's all, at least at first sight.

If you're interested by getting it somewhat more i18n, the first point is probably the pure coding ones. The last one can simply by in the XML strings* files. The 12h/24h could be a toggle. As for the notation, including the pre/suffixes, I don't know enough LUA but it's widespread use in PHP web softwares to ask in or near the translation modules the desired format (usually using strftime (https://fr2.php.net/strftime) meaning the localization input look something like “%H h %M” or “%Y-%m-%d”).

Another–simpler to code, less simpler to use–way to do this is standard compliance (hello ISO-8601).

But, isn't there some C++ (or whatever is used by FG) or even LUA library somewhere for calendars, dates and times? Should be simpler than to re-write anything, and we'll get i10n and i18n with it, moving holidays (like Easter and with it almost all Christian dates), and the like?

Trenloe
January 17th, 2014, 20:27
Although… what's an “epoch”? I know what it is, but what's the possible use in this type of calendars?
It's basically a label:

AD or BC in the Gregorian calendar.
AR for "Absalom Reckoning" in the Pathfinder Golarion setting.
TA for Third Age in Middle Earth.
etc.
etc.

Moon Wizard
January 17th, 2014, 20:32
Here are some epoch examples. The field is not required, and can be left blank.
* Gregorian: BC (Before Christ) and AD (Anno Domini)
* Greyhawk: CY (Common Year)

To change Sunday from the first day of the week can be done with an extension and new calendar module.
* In the modules, change the data to reflect your new order of day names (lunarweek.day#), and specify a unique value for lunardaycalc/periodvarcalc (i.e. gregorian2)
* In the extension, use CalendarManager.registerLunarDayHandler("gregorian2", fn) and CalendarManager.registerMonthVarHandler("gregorian2", fn) to register function handlers for those calculations. If you that is the only assumption you are changing from the Gregorian calendar, then the functions will be identical, except that the calcGregorianLunarDay function needs to be changed to subtract 1 and wrap around (0->7).

Adding a complete formatting system to the CalendarManager would be nice (i.e. MYD ordering, commas, AM/PM, time notation), but I'm going to punt on this one for now. The formatting option would need to be a separate from the calendar data, since it's more of a preference than part of the calendar.

I'll patch up the "The date is"/"The time is" and the suffixes in the next cycle.

Cheers,
JPG

Blacky
January 17th, 2014, 21:00
It's basically a label:

AD or BC in the Gregorian calendar.


Ahhhh! That makes sense, thanks!

And thanks JPG.

CB Droege
August 6th, 2014, 20:32
I don't see a tag for defining the Epoch name. Is that not in the xml?

Moon Wizard
August 7th, 2014, 00:05
No, it's not defined by the calendar definition. It's just a string field for GM to set.

Cheers,
JPG