Starfinder Playlist
Page 6 of 20 First ... 4567816 ... Last
  1. #51
    Quote Originally Posted by Alyksandrei View Post
    I'm also looking for a way to start my calendar in the middle of the "week"...and to wrap each year (like our real-world calendar) such that if the last day of one year is on Eighth-day, the first day of the next year is on Ninth-day. Is there a way to handle this in FG, or do I need to start each year on the first day of the week, and calculate the number of days in a year to end the year on the last day of the week?
    Hopefully this will help you as it took me some time to reverse engineer the code using various examples to finally achieve what I wanted!

    This is the code for my calendar.lua file.
    You will need to make sure that any variable declarations match what is in your db.xml and extension.xml files!


    -- This function sets up our custom calendar calling functions.
    --

    function onInit()
    -- Register the function to calculate the day of week for the Twilight calendar. In the calender mod db.xml, you tell FG which function to use with the <lunardaycalc type="string">Twilight</lunardaycalc> tag.
    CalendarManager.registerLunarDayHandler("Twilight" , calcTwilightLunarDay);
    -- Register the function to calculate additional days for a month in a leap year for the Twilight calendar. In the calender mod db.xml, you tell FG which function to use with the <periodvarcalc type="string">Twilight</periodvarcalc> tag
    -- CalendarManager.registerMonthVarHandler("Twilight" , calcTwilightMonthVar);
    end

    -- This function is the default Gregorian day of week calculation defined in CoreRPG. It calculates the day of the week based on the year, month and day. For a full explanation of the math involved, see https://cs.uwaterloo.ca/~alopez-o/math-faq/node73.html


    function calcTwilightLunarDay(nYear, nMonth, nDay)
    local rYear = nYear * 362; --total days in the calendar year
    local arrayMonthDays = {0,28,58,89,120,150,178,209,239,269,300,331,362}; --months broken into days starting with month 0
    if (nMonth == 0)
    then
    nMonth = 1; --sets current month?
    end
    local rMonthDays = arrayMonthDays[nMonth];
    local rDay = (rYear + rMonthDays + nDay)%7; --not sure what this does yet?
    return (rDay+6); --sets start day of the year
    end

  2. #52
    Mattekure,

    Do you know or have a tutorial on how to modify the format of the date that is provided when you click the button on the calendar that sends the date to the chat box by any chance?

    Thanks in advance!

  3. #53
    Quote Originally Posted by ChipDancer View Post
    Mattekure,

    Do you know or have a tutorial on how to modify the format of the date that is provided when you click the button on the calendar that sends the date to the chat box by any chance?

    Thanks in advance!
    I dont have a specific tutorial on it. There are 2 other handlers you can register to control how dates are displayed when output to chat (CalendarManager.registerDayDisplayHandler and CalendarManager.registerDateDisplayHandler). Here is an example from the traveller calendar.

    Code:
    function onInit()
    	CalendarManager.registerDayDisplayHandler("xtraveller_imperial", TravdisplayImperialDay);
    	CalendarManager.registerDateDisplayHandler("xtraveller_imperial", TravdisplayImperialDate)
    end
    
    function TravdisplayImperialDay(nDay)
    	return string.format("%03d", nDay);
    end
    function TravdisplayImperialDate(sEpoch, nYear, nMonth, nDay, bAddWeekDay, bShortOutput)
    	local sDay = TravdisplayImperialDay(nDay);
    	
    	local sOutput;
    	if bShortOutput or (nYear == 0) then
    		sOutput = sDay;
    	else
    		sOutput = string.format("%05d", nYear) .. "-" .. sDay;
    	end
    	return sOutput
    end
    For support with any of my extensions, visit my #mattekure-stuff channel on Rob2e's discord https://discord.gg/rob2e

  4. #54
    Thanks Mattekure!

    I was able to mostly get what I wanted, well damned near everything with your example and thought to share what I did to get my results!

    Here is my date to chat results:

    The date is the 12nd day of Falon'Din (Hollows Breath), Year 382, Era of Twilight

    The problem I am seeing is in the day suffix: day 11 is always the 11st, and day 13 is always the 13rd instead of 13th. No clue where to address this at! LOL!
    -any help would be great, but it's a little thing compared to everything else!

    Here is the code function so people can see the changes I made for my date to chat results:
    The file is manager_calendar.lua


    function getDateString(sEpoch, nYear, nMonth, nDay, bAddWeekDay, bShortOutput)
    local sDateFormat = DB.getValue("calendar.data.dateformat");
    if sDateFormat and aDateDisplay[sDateFormat] then
    return aDateDisplay[sDateFormat](sEpoch, nYear, nMonth, nDay, bAddWeekDay, bShortOutput);
    end

    local sMonth = getMonthName(nMonth);
    local sSuffix = Interface.getString("message_calendardaysuffix" .. (nDay % 10));
    local sDay = tostring(nDay) .. (sSuffix or "");

    local sOutput;
    if bShortOutput or (nYear == 0) then
    sOutput = sDay .. " " .. sMonth;
    else
    sOutput = "the " .. sDay .. " day of " .. sMonth .. ", Year " .. nYear .. ", Era of " .. sEpoch;
    end
    -- if bAddWeekDay then
    -- local nWeekDay = getLunarDay(nYear, nMonth, nDay);
    -- local sWeekDay = getLunarDayName(nWeekDay);
    -- sOutput = sWeekDay .. ", " .. sOutput;
    -- end
    return sOutput;

  5. #55
    Hello. Is there a way to insert information for the players or for the GM in the module? Where?
    - - -
    FG Classic / FG Unity Ultimate
    Playing D&D 5th

  6. #56
    Quote Originally Posted by fabiocm View Post
    Hello. Is there a way to insert information for the players or for the GM in the module? Where?
    Uhm...You are going to need to be a lot more specific with your question! LOL!!!

    What information are you trying to insert and where and from are you trying to insert it?


  7. #57
    LordEntrails's Avatar
    Join Date
    May 2015
    Location
    -7 UTC
    Posts
    17,273
    Blog Entries
    9
    Quote Originally Posted by fabiocm View Post
    Hello. Is there a way to insert information for the players or for the GM in the module? Where?
    If you double click on a date, a window will open. You can enter GM only or Player info there.

    Problems? See; How to Report Issues, Bugs & Problems
    On Licensing & Distributing Community Content
    Community Contributions: Gemstones, 5E Quick Ref Decal, Adventure Module Creation, Dungeon Trinkets, Balance Disturbed, Dungeon Room Descriptions
    Note, I am not a SmiteWorks employee or representative, I'm just a user like you.

  8. #58

  9. #59
    Quote Originally Posted by ChipDancer View Post
    Uhm...You are going to need to be a lot more specific with your question! LOL!!!

    What information are you trying to insert and where and from are you trying to insert it?

    Yeah, I'm seeing
    Let's see if my english can be a little better now.

    What I meant is: how to create a calendar module with some log entries whitin it? For example, I don't want only the holiday name, I want the full description of this holiday in the log.

    Calendar.png

    I want to add information in the red rectangle direct from the module.
    - - -
    FG Classic / FG Unity Ultimate
    Playing D&D 5th

  10. #60
    I am not sure if you can tag calendar info in a module precisely, maybe, I have had no need to test that, but you can always post the information into the calendar date directly in the players txt box to simulate the same thing or and perhaps easier, create the information in the module story element as a text formatted paragraph (s) and just share using the text to chat button from the story element. Hope that helps.

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