STAR TREK 2d20
Page 2 of 2 First 12
  1. #11
    Okay, I seem to be too dumb to include a script file.

    in the extension.xml I added:

    <script file="scripts/calendar_day.lua" />

    so far so good.
    The calendar_day.lua is in place inside the correct folder and I changed the colors to my liking.
    Inside FGU unfortunately nothing changes.

    Do I need to add / change anything for the file to execute correctly?
    Thanks for your help and patience everyone.
    Last edited by SirMotte; May 28th, 2020 at 22:25.

    I support ORC(L) and #opendnd!

    Check out my Extensions and Materials for FGU!
    Dark Theme: Sir Motte's Magnificent Darkness - Hearth Edition.
    Custom GM Icon: Sir Motte's GM Icon Replacer.
    Midjourney Art: AI generated images for my campaign.

  2. #12
    Bump. I'm sure this can be solved easily and it would enable me to finish up v 1.2 of my themes for publishing . Sorry to nag, but I wasn't able to figure this one out myself .
    Last edited by SirMotte; May 29th, 2020 at 23:20.

    I support ORC(L) and #opendnd!

    Check out my Extensions and Materials for FGU!
    Dark Theme: Sir Motte's Magnificent Darkness - Hearth Edition.
    Custom GM Icon: Sir Motte's GM Icon Replacer.
    Midjourney Art: AI generated images for my campaign.

  3. #13
    To run code you've written in an extension there are a few steps you need.
    The first thing you need to do is to first register the script file in extensions.xml as you've done.

    Alternatively if you need to call the scripts functions somewhere you need to give the name a script, such as in the example below:

    Code:
    <script name="MenuItemRegister" file="scripts/menu_item_register.lua" />
    If you want your new script to run on boot, then you need to add a function in the top of your script called onInit(), like below.:

    Code:
    function onInit()        
        registerMenuItems();        
    end
    
    function registerMenuItems()
    ...
    end
    Alternatively you can call the function from any code section of any of your lua files in that extension if you gave it a name like above. Such as here:

    Code:
    function someFunctionFoo()
      ...
      MenuItemRegister.registerMenuItems;   
      ...
    end
    The final way to do this is more specific, in the cases you're overriding an already existing function. You then need to create an onInit() function, which includes the overriding. And then FG will call the override function when that event occurs, such as for when overriding mouse wheel scrolling over a Token. Token.onWheel is the inbuilt API function (https://www.fantasygrounds.com/refdoc/Token.xcp#onWheel), which I'm overriding here with my own onWheel function.:

    Code:
    function onInit()    
        Token.onWheel = onWheel;
    end
    
    
    function onWheel(token, notches)
        if token == nil then
            return;
        end
        ...
    end
    Last edited by StoryWeaver; May 30th, 2020 at 18:46.
    Extension writer, FGU Backer, Ultimate License holder.

    5E Enhancer (development and support on hold for now)

    Combat Enhancer 5E Classic (no longer officially supported, community support only)

    ps. Do not send PM's for support for the extensions I write, I will not not be able to respond there. Use the relevant forum threads instead so the community can benefit from the replies, thank you.



  4. #14
    [SOLVED]

    Oookay.....it was a long road, but I got it....turned out I didn't need to do any additional coding! Your insight led me to the following discovery:

    Within the utility_calendar.xml was an entry pointing the file directory of the calendar_day.lua to its default location. I simply had to change this to the correct folder...done -.-.
    I had the idea because you told me how to define the script name, so I was wondering if the default name was mentioned anywhere else, overwriting my changes.

    THANK YOU SO MUCH, I'll make sure to give your Themes extra care!

    Thanks to everyone for your guidance, I feel like I have learned a lot through this.
    Last edited by SirMotte; May 30th, 2020 at 22:03.

    I support ORC(L) and #opendnd!

    Check out my Extensions and Materials for FGU!
    Dark Theme: Sir Motte's Magnificent Darkness - Hearth Edition.
    Custom GM Icon: Sir Motte's GM Icon Replacer.
    Midjourney Art: AI generated images for my campaign.

  5. #15
    Happy to help, glad it worked out!
    Extension writer, FGU Backer, Ultimate License holder.

    5E Enhancer (development and support on hold for now)

    Combat Enhancer 5E Classic (no longer officially supported, community support only)

    ps. Do not send PM's for support for the extensions I write, I will not not be able to respond there. Use the relevant forum threads instead so the community can benefit from the replies, thank you.



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
  •  
FG Spreadshirt Swag

Log in

Log in