Fantasy Grounds Fridays Pre
  1. #1

    Can An Extension Be Stopped From Loading?

    Greetings All,

    I am trying to stop an Extension from loading if another Extension has not been previously loaded.
    Thanks In Advance,
    D

  2. #2
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Newcastle, UK (for a bit)
    Posts
    27,272
    See the <dependency> tag: https://fantasygroundsunity.atlassia...nsions+-+Files

    Unfortunately, it looks like this has been removed from FGU: https://www.fantasygrounds.com/forum...l=1#post467197
    FG Con 16 Fantasy Grounds Online RPG Convention - Postponed New date To Be Confirmed.
    Register at www.fg-con.com for all the latest info.

    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
    Quote Originally Posted by Trenloe View Post
    See the <dependency> tag: https://fantasygroundsunity.atlassia...nsions+-+Files

    Unfortunately, it looks like this has been removed from FGU: https://www.fantasygrounds.com/forum...l=1#post467197
    Dammit.

    As a developer in the real world, I use libraries for everything.

    Either I centralise everything in a Common Extension or I copy files between all my Extensions.

    So with your response I will have to just ensure the Common Extension is loaded and hope that anyone using my Extension does the same thing.

    Stopping an Extension from loading with a simple return false from an onInit() would be sufficient and it would be up to the developer to check if the required Extension is loaded or not.
    Thanks In Advance,
    D

  4. #4
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    22,117
    Blog Entries
    1
    I wonder if it has been removed until we can determine the best way to implement this going forward like token locking?

    MoreCore - Generic Ruleset
    --- Projects ---
    Extensions | Tutorials | MoreCore | MoreCore Themes | Call of Cthulhu | Maelstrom | FG Con

  5. #5
    bmos's Avatar
    Join Date
    Jun 2019
    Location
    Maine, USA
    Posts
    597
    Quote Originally Posted by UrsaTeddy View Post
    Dammit.

    As a developer in the real world, I use libraries for everything.

    Either I centralise everything in a Common Extension or I copy files between all my Extensions.

    So with your response I will have to just ensure the Common Extension is loaded and hope that anyone using my Extension does the same thing.

    Stopping an Extension from loading with a simple return false from an onInit() would be sufficient and it would be up to the developer to check if the required Extension is loaded or not.
    You can 'kind of' do this with if statements.
    Just check for the name of the script that you depend on before triggering the code that depends on it.
    Not perfect, but avoids errors.

    See the onInit function here which only sets the handler if the ClockAdjuster extension is loaded.
    Last edited by bmos; August 13th, 2020 at 01:00.
    bmos' pathfinder 1e extensions
    Discord Tag: wil.thieme#3396

  6. #6
    Quote Originally Posted by bmos View Post
    You can 'kind of' do this with if statements.
    Just check for the name of the script that you depend on before triggering the code that depends on it.
    Not perfect, but avoids errors.

    See the onInit function here which only sets the handler if the ClockAdjuster extension is loaded.
    @bmos

    Your code does not illustrate my situation.

    You are adding a handler based on a condition, however what I want to do is to completely block an Extension from loading.

    So for example an Extension that adds a new Attribute to the character sheet but requires FancyExtension to be loaded still loads even if I do the check for FancyExtension being loaded or not.

    What I want is to completely halt/unload the extension if it cannot find the required FancyExtension.
    Thanks In Advance,
    D

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Joshua Stream Pre

Log in

Log in