-
September 16th, 2020, 17:04 #1
Is there a way to apply User.getRulesetName() filter on a chunk of XML code?
I have a generic extension that I wish to add a non generic piece for a specific ruleset - but if I try to just modify the windowclass with a merge statement I get an error in rulesets that don't support it. I know in lua code I can use
Code:if User.getRulesetName() == "5E" then
Free(Forums/Forge) Extension(FGU 5E):
Paid (Forge) Extension(FGU 5E):
-
September 16th, 2020, 17:35 #2
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,558
I'm not following exactly what you are trying to do. Simple examples are always best when sharing ideas and issues. I'm going to take a stab without knowing exactly what you are after.
There is a "ruleset" attribute you can add to top-level tags in extensions that will limit top-level XML tags to being processed in one specific ruleset. It does not work within assets, only at the top-level. (Similar to version tag.) This is a very simple option, and does not provide if...else, wildcard, or any other logic.
If that doesn't work for you, then you'll most likely need to handle dynamically in script code.
Regards,
JPG
-
September 16th, 2020, 17:51 #3
That is in extension.xml and limits only what extension can be used if its the one I'm thinking of - that is not what I want. The example would be as follows in record_npc.xml (which exists in many rulesets). If I add this to my generic extension the merge will generate errors for versions of record_npc.xml that do not have "npc_combat" - which I think is only in "5E" - so I'd want to not have this do anything for those other rulesets. You mention a "ruleset" attribute and if I'm right that is something I use already as is for the entire extension - not what I want here.
Code:<!-- Only present in 5E - support dropping weapons into NPC actions --> <windowclass name="npc_combat" merge="join"> <sheetdata> <list_npcactions name="actions" merge="join"> <script> function onDrop(x, y, draginfo) if draginfo.isType("shortcut") then local sClass = draginfo.getShortcutData(); Debug.console("npc_combat drop: " .. tostring(sClass)); if sClass == "reference_weapon" or sClass == "reference_magicitem" or sClass == "reference_armor" or sClass == "item" then local nodeSource = draginfo.getDatabaseNode(); MapParcelManager.addItemDrop(getDatabaseNode(), nodeSource); return true; end end end </script> </list_npcactions> </sheetdata> </windowclass>
https://www.fantasygrounds.com/forum...n-token-in-mapLast edited by SilentRuin; September 16th, 2020 at 17:55.
Free(Forums/Forge) Extension(FGU 5E):
Paid (Forge) Extension(FGU 5E):
-
September 16th, 2020, 17:53 #4
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,558
Yeah, you would need to add the ruleset tag to the windowclass tag in your example. Then, it would only be parsed if the ruleset="5E".
Regards,
JPG
-
September 16th, 2020, 17:58 #5Free(Forums/Forge) Extension(FGU 5E):
Paid (Forge) Extension(FGU 5E):
-
September 16th, 2020, 18:03 #6Free(Forums/Forge) Extension(FGU 5E):
Paid (Forge) Extension(FGU 5E):
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks