FG Spreadshirt Swag
  1. #1

    Calendar Database Usage Question

    So currently I am using

    Code:
            local nday = DB.getValue("calendar.current.day");
            local nMonths = DB.getValue("calendar.current.month");
            local nYears = DB.getValue("calendar.current.year");
    to get a numerical representation of the current date in the calendar loaded in FG.

    But... how can I get the strings representing what the name of the month or day might be actually called? For instance, month #2 in the currently loaded calendar might be called "JimSockstober"... how can I reach into the DB and get that string if the date is currently set within that month?

    I have boosted up the code for date calls within story templates per a forum member's requests, but I want to go a step further and implement full support for fantasy calendars instead of just gregorian, and to do so I need to know how to crack this nut!

  2. #2
    EDIT: I think I found it. I'll post here if I am correct!

  3. #3
    Ok yep I cracked it.
    For anyone later searching for this same information, see below:

    Code:
                local nDays = DB.getValue("calendar.current.day");
                local nMonths = DB.getValue("calendar.current.month");
                local nYears = DB.getValue("calendar.current.year");
                local nEpoch = DB.getValue("calendar.current.epoch");
    
                local monthName = CalendarManager.getMonthName(nMonths);
                local nWeekDay = CalendarManager.getLunarDay(nYears, nMonths, nDays);
                local sWeekDay = CalendarManager.getLunarDayName(nWeekDay);
                local sSuffix = Interface.getString("message_calendardaysuffix" .. (nDays % 10));
                
                local dayWithSuffix = tostring(nDays) .. (sSuffix or "");
                local dayName = sWeekDay
                local fullmonth = monthName
    Last edited by JimSocks; June 14th, 2021 at 05:20.

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