DICE PACKS BUNDLE
  1. #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
    Type of check to filter out doing things for rulesets that don't support things - but how do I do that in XML's where I'm grafting on logic into an XML file (that exists in all rulesets I support) which does not support the particular windowclass I'm trying to merge stuff into (only exists in certain rulesets)?
    Free(Forums/Forge) Extension(FGU 5E):
    Paid (Forge) Extension(FGU 5E):

  2. #2
    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

  3. #3
    Quote Originally Posted by Moon Wizard View Post
    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
    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>
    Also, if you get a chance I'm desperate for an answer to this question:

    https://www.fantasygrounds.com/forum...n-token-in-map
    Last edited by SilentRuin; September 16th, 2020 at 17:55.
    Free(Forums/Forge) Extension(FGU 5E):
    Paid (Forge) Extension(FGU 5E):

  4. #4
    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

  5. #5
    Quote Originally Posted by Moon Wizard View Post
    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
    I'll give it a try assuming its literally ruleset="5E" - thanks.
    Free(Forums/Forge) Extension(FGU 5E):
    Paid (Forge) Extension(FGU 5E):

  6. #6
    Quote Originally Posted by Moon Wizard View Post
    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
    Awesome - wish I could do something for you in turn! Superficial test seems to show it works great - time will tell for sure but THANKS!
    Free(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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
FG Spreadshirt Swag

Log in

Log in