5E Character Create Playlist
  1. #1

    Crosslinking between extensions

    I've made two extensions now, and I've also made an icon that I only want displayed if both of these extensions have been loaded at the same time.
    (It's an button_roll icon graphic for the Kult ruleset, with a Ghost Theme background.)
    Randomly surfing around on the internet, just randomly clicking at links to Fantasy Grounds sites that show up on the first hit page, "reveals" that there doesn't seem to be any onLoaded() function to keep track of what extensions are loaded into a session, but I've seen that instances can be checked for the existence of tags, by scripts inside templates, so there might be some "if exists" condition in a script, that could be able to either check the existence of another script, or the image to use itself.

    Something like this, would be nice:
    Code:
    onDesktopInit()
    	if exists extension Ghost
    		<includefile source="crosslink/ghostkult.xml" />
    	end
    end
    First I thought that all extensions would share the same virtual folder structure, and that I could therefor just put "<includefile source="crosslink/kult.xml" />" into the initiation file of Kult, and "crosslink/kult.xml" (containing the merging instructions) in Ghost, but then FG refused to load Kult because it couldn't find the file to include, and this despite of it being present in Ghost. I don't know if changing the load order for Ghost would change anything, but I doubt it.

    ...so is there any way to do this sort of conditional "only if extension/ruleset is present" merge?

  2. #2
    LordEntrails's Avatar
    Join Date
    May 2015
    Location
    -7 UTC
    Posts
    17,150
    Blog Entries
    9
    Not sure if this would help, but the DOE extensions use a function/capability that requires the DOE Base to be loaded before any of the other extensions will work. Might give you what you are looking for.

    Problems? See; How to Report Issues, Bugs & Problems
    On Licensing & Distributing Community Content
    Community Contributions: Gemstones, 5E Quick Ref Decal, Adventure Module Creation, Dungeon Trinkets, Balance Disturbed, Dungeon Room Descriptions
    Note, I am not a SmiteWorks employee or representative, I'm just a user like you.

  3. #3
    Quote Originally Posted by LordEntrails View Post
    Not sure if this would help, but the DOE extensions use a function/capability that requires the DOE Base to be loaded before any of the other extensions will work. Might give you what you are looking for.
    Isn't that just done with a <dependency> tag? I don't want the entire extension to fail. I want them both to work individually without problems, but when they work together, something extra also happens. That's a little more complicated.

    While I was randomly looking around for tags just now, I happened to stumble onto a function called "getExtensions()", which apparently retrieves a list of names of loaded extensions. "A list" sounds complicated to script a retrieval from, but might be what I'm looking for.

    The problem with that is that not even Moon Wizard knows how that works:
    Make sure you are using pairs() and not ipairs() to interate over table. The rulesetdepencies table is ("string" -> table ("minrelease"="MIN", "maxrelease"="MAX"), "string" -> ...)
    It's the same for "extensiondependencies".
    Exclusion groups are a way to prevent more than one type of a given extension from loading (i.e. Themes), though it's not really used in practive. That data should be under "exclusiongroups".
    Try a Debug.console(getExtensionInfo(s)) to review the full output.
    NOTE: I did not have a change to build out code to double-check all of this; so let me know if it's not working as expected.
    ...and it didn't work for some reason, and Moon Wizard never got back to him, so I guess it's all a mystery for tomorrow, once I've slept. (I wonder what "pairs()" is.) Also there's "[DEV] Added Extension.getExtensions and Extension.getExtensionInfo functions (similar to Module functions)", so I might also want to find out what a "module" is.

    If I'm really lucky I'll even find how to use it in the DOE extension that you mentioned. (I'll do a word search and hope for the best.)

    This thread also talks how to do the syntax for identifying extensions loaded based on their unique script names, but that sounds like a much less elegant solution:
    https://www.fantasygrounds.com/forum...tensions/page2

    At least I've got plenty of leads now. Just gotta sleep now, so that I can think.

  4. #4
    Damned was on the right track. What you need is my custom fpIsExtensionLoaded() function, which I now give you permission to use (everyone else: please ask before using) - I am still retaining all Copyright to this

    Code:
    fpIsExtensionLoaded()
    
    sExtensionName = The name of the extension you are trying to determine is loaded or not.
    Returns TRUE if the extension is loaded, FALSE if otherwise.
    
    
    function fpIsExtensionLoaded(sExtensionName)
    	for kKey,vValue in pairs(Extension.getExtensions()) do
    		if string.find(sExtensionName,vValue) then
    			return true;
    		end
    	end
    	return false
    end
    So, that'll need to go ito one or both of your Extensions, and if TRUE, display your icon.

    Hope that helps

    Cheers
    Last edited by dulux-oz; January 16th, 2020 at 11:18. Reason: Better Version of the Code
    Dulux-Oz

    √(-1) 2^3 Σ Π
    ...And it was Delicious!


    Alpha-Geek
    ICT Professional
    GMing Since 1982
    NSW, Australia, UTC +10
    LinkedIn Profile: www.linkedin.com/in/mjblack

    Watch our games on Twitch: www.twitch.tv/dulux_oz

    Support Me on Patreon: www.patreon.com/duluxoz

    Past Games, etc, on my YouTube Channel: www.youtube.com/c/duluxoz

  5. #5
    Quote Originally Posted by dulux-oz View Post
    Damned was on the right track. What you need is my custom fpIsExtensionLoaded() function, which I now give you permission to use (everyone else: please ask before using) - I am still retaining all Copyright to this
    Code:
    fpIsExtensionLoaded()
    sExtensionName = The name of the extension you are trying to determine is loaded or not.
    Returns TRUE if the extension is loaded, FALSE if otherwise.
    fpIsExtensionLoaded(sExtensionName)
    	for nIndex,sName in pairs(Extension.getExtensions()) do
    		if string.find(sName,sExtensionName) then
    			return true;
    		end
    	end
    	return false
    end
    So, that'll need to go ito one or both of your Extensions, and if TRUE, display your icon.
    Hope that helps
    Cheers
    Thank you! This is exactly what I was looking for.
    However, from a technical standpoint, picking an entry from a list, is so fundamental that I doubt you're able to claim a copyright for it. I'm pretty sure that the creator of lua would object.

  6. #6
    Quote Originally Posted by MooCow View Post
    Thank you! This is exactly what I was looking for.
    However, from a technical standpoint, picking an entry from a list, is so fundamental that I doubt you're able to claim a copyright for it. I'm pretty sure that the creator of lua would object.
    Actually, I can, am, and will continue to claim Copyright on the implementation of that piece of logic, as per the relevant (Australian & International) Copyright Law.

    I take Copyright very seriously, both on my own code and on using others', as I deal with Copyright issues at a senior level regularly.

    Anyway, I hope that piece of code helps you with your extensions.

    Cheers
    Dulux-Oz

    √(-1) 2^3 Σ Π
    ...And it was Delicious!


    Alpha-Geek
    ICT Professional
    GMing Since 1982
    NSW, Australia, UTC +10
    LinkedIn Profile: www.linkedin.com/in/mjblack

    Watch our games on Twitch: www.twitch.tv/dulux_oz

    Support Me on Patreon: www.patreon.com/duluxoz

    Past Games, etc, on my YouTube Channel: www.youtube.com/c/duluxoz

  7. #7
    Oberoten's Avatar
    Join Date
    May 2006
    Location
    Älvsbyn, Sweden
    Posts
    2,620
    Quote Originally Posted by dulux-oz View Post
    Damned was on the right track. What you need is my custom fpIsExtensionLoaded() function, which I now give you permission to use (everyone else: please ask before using) - I am still retaining all Copyright to this

    Code:
    fpIsExtensionLoaded()
    
    sExtensionName = The name of the extension you are trying to determine is loaded or not.
    Returns TRUE if the extension is loaded, FALSE if otherwise.
    
    
    fpIsExtensionLoaded(sExtensionName)
        for nIndex,sName in pairs(Extension.getExtensions()) do
            if string.find(sName,sExtensionName) then
                return true;
            end
        end
        return false
    end
    So, that'll need to go ito one or both of your Extensions, and if TRUE, display your icon.

    Hope that helps

    Cheers
    This is brilliant Dulux. Could I use? I will of course as always retain copyright notices and credit where due.

    - Obe
    For your Ars Magica needs :
    https://fgrepository.com




    Atque in perpetuum frater, Ave atque vale.

  8. #8
    Quote Originally Posted by dulux-oz View Post
    Actually, I can, am, and will continue to claim Copyright on the implementation of that piece of logic, as per the relevant (Australian & International) Copyright Law.
    I take Copyright very seriously, both on my own code and on using others', as I deal with Copyright issues at a senior level regularly.
    Anyway, I hope that piece of code helps you with your extensions.
    Cheers
    Since your draconian measures are trying to restrict people from using basic script functionality on this platform, I'd like to challenge your copyright claim, but I don't have to. I don't have to implement your code as-is. I just have to learn the syntax used in it, and then use that syntax to make my own code, since it happens to have a different purpose. ...but legally, and variable names aside, you're not the first person to have used that data retrieval routine, so if there's any copyright what-so-ever, it belongs to one of the hundreds of writers before you.

  9. #9
    Quote Originally Posted by Oberoten View Post
    This is brilliant Dulux. Could I use? I will of course as always retain copyright notices and credit where due.

    - Obe
    Yes Obe, you can use the function, not a problem - I'm always willing to help out people who are polite
    Dulux-Oz

    √(-1) 2^3 Σ Π
    ...And it was Delicious!


    Alpha-Geek
    ICT Professional
    GMing Since 1982
    NSW, Australia, UTC +10
    LinkedIn Profile: www.linkedin.com/in/mjblack

    Watch our games on Twitch: www.twitch.tv/dulux_oz

    Support Me on Patreon: www.patreon.com/duluxoz

    Past Games, etc, on my YouTube Channel: www.youtube.com/c/duluxoz

  10. #10
    Quote Originally Posted by MooCow View Post
    Since your draconian measures are trying to restrict people from using basic script functionality on this platform, I'd like to challenge your copyright claim, but I don't have to. I don't have to implement your code as-is. I just have to learn the syntax used in it, and then use that syntax to make my own code, since it happens to have a different purpose. ...but legally, and variable names aside, you're not the first person to have used that data retrieval routine, so if there's any copyright what-so-ever, it belongs to one of the hundreds of writers before you.
    You can characterise my "measures" as you wish, up and to the point where you liable me (at which point I hope you are or know a very good lawyer) - and, yes, you certainly can take the ideas expressed in that piece of code and create your own implementation - but the implementation I provided to you - which I didn't have to - and free of charge - *IS* Copyrightable under all relevant Law and I am expressing my Copyrights as such.

    I didn't say you couldn't use it - in fact, I put no restrictions on your use of it at all, except to express my rights. I've even said other can use it, and asked them to ask me first; this is just common courtesy and one of the principles of this community: Ask before using someone else's code.

    But this is what I get for helping someone new to this Community out: accusations of "draconian measures" designed to "restrict people from using basic script functionality on this platform". Well, let me tell you something: there's a reason my Reputation on this site is as high as it is. It's because I provide all sorts of code, simple and advanced, plus Extensions and Rulesets, to this Community, most of it for free. *ALL* of it is Copyrightable, and all of it is useful to my fellow Devs and general FG Users alike. I've gone out of my way to be a useful, helpful member of this Community, and the Community has responded with thanks, praise, Reputation, and kudos - my record stands for itself.

    So don't bother asking me for help (directly or indirectly) in the future, because you won't get it. Why should I help a rude, inconsiderate, "newbie" who doesn't know when to accept a gift that is given to him?!

    Don't bother replying - I won't be answering.

    [EDIT: Remove content that could inflame situation even though it was not intended that way.]
    Last edited by Moon Wizard; January 17th, 2020 at 18:33.
    Dulux-Oz

    √(-1) 2^3 Σ Π
    ...And it was Delicious!


    Alpha-Geek
    ICT Professional
    GMing Since 1982
    NSW, Australia, UTC +10
    LinkedIn Profile: www.linkedin.com/in/mjblack

    Watch our games on Twitch: www.twitch.tv/dulux_oz

    Support Me on Patreon: www.patreon.com/duluxoz

    Past Games, etc, on my YouTube Channel: www.youtube.com/c/duluxoz

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
  •  
STAR TREK 2d20

Log in

Log in