Thread: Crosslinking between extensions
-
January 14th, 2020, 00:30 #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
...so is there any way to do this sort of conditional "only if extension/ruleset is present" merge?
-
January 14th, 2020, 01:55 #2
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.
-
January 14th, 2020, 02:55 #3
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.
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.
-
January 14th, 2020, 03:21 #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
Hope that helps
CheersLast 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
-
January 14th, 2020, 13:32 #5
-
January 15th, 2020, 02:16 #6
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.
CheersDulux-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
-
January 15th, 2020, 02:41 #7
-
January 15th, 2020, 03:28 #8
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.
-
January 15th, 2020, 10:13 #9
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
-
January 15th, 2020, 10:37 #10
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