PDA

View Full Version : Can a module check for an extension?



irpagan
June 14th, 2015, 19:05
Is there a way to have a module check for an extension? Secondarily, Is there a way to have an extension support more than one ruleset?

If not that is fine, I was just thinking of user experience. I was taking a break from coding and threw together a calendar for the Talislanta ruleset I'm working on and wrote a quick extension to support the calendar changes that go along with it.

I'm rather happy with it and will release it along with the ruleset once completed.

Regards,
-d0gb0y

Trenloe
June 14th, 2015, 19:38
Modules are available for activation purely based off the <ruleset> they are tagged with. They don't have any code within them - they are purely data.

You can put mutiple <ruleset> tags in the <properties (https://www.fantasygrounds.com/refdoc/properties.xcp)> section of extension.xml in an extension. See theme_wood.ext as an example.

irpagan
June 14th, 2015, 20:02
Thanks very much Trenloe, I was hoping I was just missing it in the docs somewhere - which is usually the case. I guess I will have to be very explicit - the extension and the calendar go together. Is there perhaps a isExtensionLoaded() function or a way to determine if a particular extension is loaded? I'll tag the extension.xml for other rulesets. I should have thought of checking that. drat.

Regards,
-d0gb0y

Trenloe
June 14th, 2015, 22:10
Is there perhaps a isExtensionLoaded() function or a way to determine if a particular extension is loaded?
Nope. Even if you could, you can only put code in your extension to check for this - you can't put code in a module. A module contains data only. I can't think of a way to prevent your module loading if the required extension isn't activated.

Moon Wizard
June 14th, 2015, 23:00
It would be have to be a new feature that allows a module to "require" an extension like it does for rulesets now.

It's an interesting idea. You should throw up on wish list.

Cheers,
JPG

irpagan
June 15th, 2015, 01:37
@Trenloe - Thank you, guess it is the explicit readme.txt and everything in one .zip. approach then.
@Moon Wizard - Done and done, https://fg2app.idea.informer.com/proj/?ia=95412

Thank you both, appreciate the assist.

Regards,
-d0gb0y