PDA

View Full Version : Inheritance control for multiple extensions?



Debinani
January 30th, 2011, 04:00
All-

My gaming group is building a few extensions over the top of Foundation - and in one circumstance we have a theme extension that we share, and a campaign-specific extension that overrides a few things in the theme extension.
Is there any way to predict the order of execution or inheritance of extensions added to a base ruleset so we can control which extension wins?

Thanks!

StuartW
January 30th, 2011, 06:53
Take a quick look at the extensions reference (https://www.fantasygrounds.com/modguide/extensions.xcp) and you can see something on extension dependencies:


Versioning and dependencies

It is possible to create extensions that build on other extensions. Some extensions that may simply introduce useful generic functionality such as scripts or templates, intended to be used by other extensions. For this purpose, an extension can be defined as requiring dependencies. Optionally, it is possible to give upper and/or lower limits for the version numbers of the dependencies accepted.

Extension dependencies

Extension dependency declarations are placed under the <properties> element in the extension.xml file. The following is an example:



<dependency>
<name>Test Dependency</name>
<minversion>1</minversion>
<maxversion>1</maxversion>
</dependency>

The <name> element defines the name of the extension required for this extension to be usable. Both <minversion> and <maxversion> are optional.

Debinani
January 30th, 2011, 16:31
I saw that - but I'm more concerned with what happens if I have two extensions that try to modify the same item.
For example - Foundation has a background image.
Extension 1 implements all my character sheets, and rules specific items. It too has a background image defined.
Extension 2 is just a GUI theme, it also has a background image defined.

I want to use Extension 1 for my game system, but I want the GUI enhancements in Extension 2 to override those in Extension 1.

If I understand correctly, dependencies would allow me to exclude the background image from extension 1 and *require* extension 2 to be present, but I'd like people to be able to run games with just Extension 1 if they wish.

StuartW
January 30th, 2011, 16:40
You could make extension 2 depend on extension 1, then you can either run none of them, or just extension 1, or both 1 and 2 (but not 2 alone).

Stuart

Debinani
January 30th, 2011, 17:08
Yes, but would that force the Extension 2 desktop to override the Extension 1 desktop? I'm worried about the order of precedence getting confused and getting mixed results.

StuartW
January 30th, 2011, 17:24
It would, the dependency turns into a load-order and later extensions override earlier ones.

You can always try it out...

Stuart

Debinani
January 30th, 2011, 17:40
Excellent! We'll give it a try.

Thanks!