forked from RPTools/maptool
-
Notifications
You must be signed in to change notification settings - Fork 6
herolab.XPath
Jamz edited this page Mar 5, 2019
·
3 revisions
This function returns data results based on the passed in XPath expression from the XML statblock. This is a reliable and easier way to get stat data from a character than using regular expression parsing of Text stat blocks.
*Note: This evaluates directly against the stored XML statblock data on the token so you do not need to first retrieve and store the XML in a variable.
- herolab.XPath(XPath)
- herolab.XPath(XPath, id)
- XPath - The XPath expression to evaluate against the XML statblock.
- id - The token id of the token to name, defaults to the Current Token.
- [race = herolab.XPath('/document/public/character/race/@name')]
- [alignment = herolab.XPath('/document/public/character/alignment/@name')]
- [improvedInit = herolab.XPath('boolean(/document/public/character/feats/feat[starts-with(@name,"Improved Initiative")])')]
<?xml version="1.0" encoding="UTF-8" standalone="no"?><document>
<public>
<program name="Hero Lab" url="http://www.wolflair.com">
<programinfo>Hero Lab and the Hero Lab logo are Registered Trademarks of LWD Technology, Inc. Free download at http://www.wolflair.com Pathfinder® and associated marks and logos are trademarks of Paizo Inc.®, and are used under license.</programinfo>
<version build="743" primary="8" secondary="4" tertiary="b" version="8.4b"/>
</program>
<localization language="eng" units="imperial"/>
<character characterindex="1" name="Drexel Spevak + New Eidolon" nature="normal" playername="" relationship="ally" role="pc" type="Hero">
<race ethnicity="" name="rakshasa-spawn tiefling" racetext="rakshasa-spawn tiefling"/>
<alignment name="Neutral Good"/>
<templates summary=""/>
<size name="Medium">
...