SieferSeesSomething
November 30th, 2024, 01:28
Can anyone help me figure out how to get the links from a linklist from a database node's formattedtext description node? I feel like I've tried everything.
Here's an excerpt from a module's client.xml file with some text changed to avoid posting any copyrighted data:
<races>
<customrace>
<description type="formattedtext">
<p><b>RACIAL TRAITS</b></p>
<p><b>Average Height</b>: 5'8" - 6'4"</p>
<p><b>Average Weight</b>: 210 - 310</p>
<p><b>Ability scores</b>: +2 AbiltityOne, +2 AbilityTwo or +2 AbilityThree</p>
<p><b>Size</b>: Medium</p>
<p><b>Speed</b>: 6 </p>
<p><b>Vision</b>: Normal</p>
<p><b>Languages</b>: Common</p>
<p><b>Skill Bonuses</b>: +2 SkillOne, +2 SkillTwo.</p>
<p><b>CustomRace Features</b></p>
<listlink>
<link class="powerdesc" recordname="reference.features.customraceacidresistance@Exampl e Module PC Options">Acid Resistance</link>
<link class="powerdesc" recordname="reference.features.customracebarbedbody@Example Module PC Options">Barbed Body</link>
<link class="powerdesc" recordname="reference.features.customracerazorstorm@Example Module PC Options">Razor Storm</link>
</listlink>
<p><b>CustomRace Racial Attack </b></p>
<listlink>
<link class="powerdesc" recordname="reference.powers.razorstorm@Example Module PC Options">Razor Storm</link>
</listlink>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore e.</p>
<p>orem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore e.</p>
<p><b>PHYSICAL QUALITIES</b></p>
I've been trying every variation of DB methods (getPath, findNode, getChildList, getc.) I can think of to get a hold of these link nodes but I can't crack the right syntax to do what I want to do. The main access I have is sRecord which I'm getting from some drag and drop shortcut data.
Debug.console("sRecord:",sRecord);
This returns
s'sRecord:' | s'reference.races.customrace@Example Module PC Options'
So far the closest I've gotten is using DB.findNode(DB.getPath(sRecord, "description")) and then sticking that into DB.getValue() but that returns all the text in there, but at least it includes the link tags.
I was hoping there was some good way to use DB.getChildren, or DB.findNode, or DB.getPath, or something to just get the links without having to do a bunch of xml processing in Lua, especially since I'm fairly new at it. I thought the trick was using some variation of getChildren, since the links seem to be child nodes of linklist which seems to be a child of description, but DB.getChildCount(DB.findNode(DB.getPath(sRecord, "description"))), keeps returning 0 so maybe that's not right, or I'm misunderstanding how to phrase it.
Does anyone know what the easiest way to do this is? Am I making sense here or was my explanation confusing?
Here's an excerpt from a module's client.xml file with some text changed to avoid posting any copyrighted data:
<races>
<customrace>
<description type="formattedtext">
<p><b>RACIAL TRAITS</b></p>
<p><b>Average Height</b>: 5'8" - 6'4"</p>
<p><b>Average Weight</b>: 210 - 310</p>
<p><b>Ability scores</b>: +2 AbiltityOne, +2 AbilityTwo or +2 AbilityThree</p>
<p><b>Size</b>: Medium</p>
<p><b>Speed</b>: 6 </p>
<p><b>Vision</b>: Normal</p>
<p><b>Languages</b>: Common</p>
<p><b>Skill Bonuses</b>: +2 SkillOne, +2 SkillTwo.</p>
<p><b>CustomRace Features</b></p>
<listlink>
<link class="powerdesc" recordname="reference.features.customraceacidresistance@Exampl e Module PC Options">Acid Resistance</link>
<link class="powerdesc" recordname="reference.features.customracebarbedbody@Example Module PC Options">Barbed Body</link>
<link class="powerdesc" recordname="reference.features.customracerazorstorm@Example Module PC Options">Razor Storm</link>
</listlink>
<p><b>CustomRace Racial Attack </b></p>
<listlink>
<link class="powerdesc" recordname="reference.powers.razorstorm@Example Module PC Options">Razor Storm</link>
</listlink>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore e.</p>
<p>orem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore e.</p>
<p><b>PHYSICAL QUALITIES</b></p>
I've been trying every variation of DB methods (getPath, findNode, getChildList, getc.) I can think of to get a hold of these link nodes but I can't crack the right syntax to do what I want to do. The main access I have is sRecord which I'm getting from some drag and drop shortcut data.
Debug.console("sRecord:",sRecord);
This returns
s'sRecord:' | s'reference.races.customrace@Example Module PC Options'
So far the closest I've gotten is using DB.findNode(DB.getPath(sRecord, "description")) and then sticking that into DB.getValue() but that returns all the text in there, but at least it includes the link tags.
I was hoping there was some good way to use DB.getChildren, or DB.findNode, or DB.getPath, or something to just get the links without having to do a bunch of xml processing in Lua, especially since I'm fairly new at it. I thought the trick was using some variation of getChildren, since the links seem to be child nodes of linklist which seems to be a child of description, but DB.getChildCount(DB.findNode(DB.getPath(sRecord, "description"))), keeps returning 0 so maybe that's not right, or I'm misunderstanding how to phrase it.
Does anyone know what the easiest way to do this is? Am I making sense here or was my explanation confusing?