DICE PACKS BUNDLE
  1. #1

    Join Date
    Mar 2020
    Location
    Sydney, Australia
    Posts
    247

    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
    Colorado, USA
    Posts
    33,404
    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
    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

    Join Date
    Mar 2020
    Location
    Sydney, Australia
    Posts
    247
    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

  5. #5
    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.

  6. #6

    Join Date
    Mar 2020
    Location
    Sydney, Australia
    Posts
    247
    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)

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
  •  
5E Product Walkthrough Playlist

Log in

Log in