Starfinder Playlist
Page 4 of 4 First ... 234
  1. #31

    Join Date
    Mar 2020
    Location
    Sydney, Australia
    Posts
    247
    No problems ...

    thank you to all for the help and guidance.
    Thanks In Advance,
    D

  2. #32
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,402
    Quote Originally Posted by UrsaTeddy View Post
    Yes, however that would mean that every extension I write would have that specific onInit code written multiple times in non-overwritable files.

    One question.

    You will note that in my files I have a semaphore indicating if that file has been executed or not ... that semaphore is not set in the global space, so if I renamed the file and loaded it under another name, all the code is executed again and the semaphore is reset to false.

    Is there a global space to do this in? Or do I have to make my own system?
    The _100_string._100_string_initialised boolean variable is available globally.

    You could do this in your earlier loaded extensions to trigger the _100_string.onInit function when first needed:

    Code:
    	if not _100_string._100_string_initialised then
    		_100_string.onInit();
    	end
    For example, in your first posted extensions, make the onInit function in 105.lua as follows:

    Code:
    function onInit( )
    
    	if not _100_string._100_string_initialised then
    		_100_string.onInit();
    	end
    	
    	Debug.chat("INITIALISING 105")
    	Debug.chat(string.concat('---','one','two','three'))
    
    end
    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. #33

    Join Date
    Mar 2020
    Location
    Sydney, Australia
    Posts
    247
    Yes I have come up with something similar as my solution.

    I have removed all onInit( ) functions and replaced them with an initialise( ) function.

    I then manually call the initialise( ) functions triggered on the extension onInit( ).

    This means that overridden code is only executed after all extensions are loaded and hence 105 will find the common library code after 110 has overridden it.

    Achieves basically what you describe and works in my end.
    Thanks In Advance,
    D

  4. #34
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,402
    Quote Originally Posted by UrsaTeddy View Post
    Yes I have come up with something similar as my solution.

    I have removed all onInit( ) functions and replaced them with an initialise( ) function.

    I then manually call the initialise( ) functions triggered on the extension onInit( ).

    This means that overridden code is only executed after all extensions are loaded and hence 105 will find the common library code after 110 has overridden it.

    Achieves basically what you describe and works in my end.
    Nice solution!
    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. #35

    Join Date
    Mar 2020
    Location
    Sydney, Australia
    Posts
    247
    I find it a little kludgy, however it lets me keep my common code base which as a developer makes me happy.

    Thank you once again for all of your help.
    Thanks In Advance,
    D

  6. #36
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,402
    Quote Originally Posted by UrsaTeddy View Post
    Thank you once again for all of your help.
    No worries! I learned some new things as part of this thread too.
    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. #37
    This is why I defined a separate StringManager script in CoreRPG to avoid this issue of initialization order.

    Regards,
    JPG

  8. #38

    Join Date
    Mar 2020
    Location
    Sydney, Australia
    Posts
    247
    @Moon Wizard ...

    My original question was answered by your description of the overwrite phase of the extension loading overwriting an onInit() which then was not executed in the space of one extension when another "replaced" the code with the exact same code.

    Your StringManager script does not have an onInit() and other rulesets that layer on top do not overwrite your StringManager but rather create another one with another name - so it avoids what happened in my extensions.

    I specifically wanted to share the same code base with all of my extensions and because I did not 100% understand the overwriting concept during load/execution I was essentially hampering my own work.

    Now that you clearly explained everything, I have a better grasp of this subsystem and was able to work around it and successfully achieve what I wanted/needed.

    In the end I had to remove all the onInit() code my common code base and manually initialise everything to solve the problem.

    Thank you once again for all the help.
    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
  •  
DICE PACKS BUNDLE

Log in

Log in