5E Product Walkthrough Playlist
Page 1 of 2 12 Last
  1. #1

    Set fonts for GM only

    I'm working on an extension to set the fonts. I only want these font settings to be modified for the GM, however.

    It seems I can use the User.isHost() function to identify that I am the GM.

    It appears that I then have 2 options. Either call the file using lua or set the fonts programmatically via lua.

    Can anyone give me some hints on how to do either of these options?

    My preference would be to use a lua command to call the file so that I could then use that same logic for other settings but I'm also fine with the other option.

    So far in my extension.xml I have the following code (which obviously doesn't work as the includefile syntax is not valid inside the script)

    -----------------
    <script>
    function setFont()
    if User.isHost() then
    <includefile source="graphics_fonts.xml" />;
    end
    end
    </script>
    ----------------

    The graphics_fonts.xml file is a fairly standard set fonts file

    ----------
    <font name="reference-h">
    <ttf file="graphics/fonts/MarcellusSC-Regular.ttf" name="Marcellus SC" size="26" />
    <color value="#660000" />
    </font>
    ----------

    I'm happy to research further if someone can point me to a reference file that might have info on this. I did read through the Fantasy Grounds Developer Guide but did not see anything to do this. Of course, it could be that it is there and I just missed it.


    Thank you for your help

  2. #2
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,408
    Unfortunately you can't change the font definitions at run time as they are all built when the layered ruleset and extensions are loaded when the campaign is started.

    The best you can do is set the font being used by an individual text control, using setFont: https://fantasygroundsunity.atlassia...ontrol#setFont

    Unfortunately, I don't think this works with formatted text controls.
    Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!

  3. #3
    Something that I ran into that might help is once when I was messing with modifying a default theme, is that when a player loaded in they saw the unmodified theme on their end. You might be able to create a player version and a gm version that still read as the same extension to Fantasy Grounds.

  4. #4
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,408
    Quote Originally Posted by ScriedRaven View Post
    Something that I ran into that might help is once when I was messing with modifying a default theme, is that when a player loaded in they saw the unmodified theme on their end. You might be able to create a player version and a gm version that still read as the same extension to Fantasy Grounds.
    In theory, that shouldn't happen. Even if the player has an extension of the same name installed locally, if it doesn't match the GMs extension, then the extension from the GM side will be downloaded and used by the player instance for that campaign. Whereas they might have been a glitch or a bug in the coding, that is not working as designed and will probably not work like that reliably or will be "fixed" before too long.
    Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!

  5. #5
    Quote Originally Posted by Trenloe View Post
    In theory, that shouldn't happen. Even if the player has an extension of the same name installed locally, if it doesn't match the GMs extension, then the extension from the GM side will be downloaded and used by the player instance for that campaign. Whereas they might have been a glitch or a bug in the coding, that is not working as designed and will probably not work like that reliably or will be "fixed" before too long.
    If I remember what I did correctly the change I made was that I deleted a couple image files (the buttons), but I left the coding unchanged. I haven't looked into it, as it doesn't normally affect me, but I might look into this evening

  6. #6
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,408
    Quote Originally Posted by ScriedRaven View Post
    If I remember what I did correctly the change I made was that I deleted a couple image files (the buttons), but I left the coding unchanged. I haven't looked into it, as it doesn't normally affect me, but I might look into this evening
    Like I said, that is not how the extensions system is designed to work. If it's doing it now, I wouldn't rely on that occurring in future - because it's a defect and may be fixed, or may not have a repeatable functionality. Of course you're free to do whatever you wish with your time. But, I just want to make this clear so that people don't spend time doing custom projects based off this assumption that end up suddenly not working.
    Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!

  7. #7
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,408
    And to follow up... even if it is possible to load different extensions on the player side (which it shouldn't be), this is not a desirable approach as loading different code to what the GM is loading can lead to unpredictable functionality and so is not recommended (very strongly not recommended).
    Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!

  8. #8
    Thank you for the answers. So definitely not possible to modify the fonts directly at run time.

    What about only calling the graphics_fonts.xml file if the person loading the extension is the host (GM)?

    In this case, the players would still have the fonts that were set as part of the ruleset, they just wouldn't have the modified fonts that are present in this extension.

    Daniel

  9. #9
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,408
    Quote Originally Posted by dllewell View Post
    What about only calling the graphics_fonts.xml file if the person loading the extension is the host (GM)?
    Nope. The GM loads everything that's enabled and then pushes all of that down to the players when they connect.
    Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!

  10. #10
    OK. A little disappointing. It seems a little clunky to force players to all have the same look and feel ... but in the grand scheme of things, it's fairly minor.

    Thank you for taking the time to answer my questions. It's very much appreciated.

    Daniel

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