PDA

View Full Version : Embarrassed to ask (getValue with "..." in path question)



Varsuuk
May 19th, 2019, 02:30
[SOLVED]

I feel I should remember this since it is something I've seen but first time I ran into it since starting back up on this this year. Looking at the DB info in API didn't give it - I'm sure it is in one of the wiki docs but I will toss this out there and see if someone answers while I am putting son to bed (reading Edgedancer as his bedtime story - my son is ROCKIN' the Sanderson) - if no one answers, will go through the Wiki and reply myself :)



...
-- Check for regular Darkvision
local sTraitName = DB.getValue(nodeSource, "name", "");
...

-- Add the item
local vNew = nodeList.createChild();
DB.copyNode(nodeSource, vNew);
DB.setValue(vNew, "source", "string", DB.getValue(nodeSource, "...name", ""));
DB.setValue(vNew, "locked", "number", 1);



So, what is the value based on the xml below that is being put into the vNew node's "<source type="string">???</source" node?



<halfling>
<name type="string">Halfling</name>
<text type="formattedtext">
<p><h>Halflings</h></p>
...

<missleweaponbonus>
<name type="string">Halfling Missle Weapon Bonus</name>
<text type="formattedtext">The Halfling player character has a +1 bonus when
using missle weapons.</text>
</missleweaponbonus>
...

Varsuuk
May 19th, 2019, 02:55
I am SO glad I decided to look for questions on Workshop to try to give something back if I knew the answer and found the guy with the ct_round? question:



Ready to start exploring the FG database? Put a number in that field in the character sheet, issue a \save chat command and open the campaign db.xml file - work out where the combattracker.round field is in the <charsheet> hierarchy and then count how many levels up to get to the root - use one more dot than number of levels you need to go up to get to the root. For example, if you need to go up 4 levels to get to the DB root, use source=".....combattracker.round" (5 dots).


Thanks Trenloe, I was braindeading... (and ME who uses "..." all the time) but I digress...

So my question is answered by going up to just the spot I suspected (it's why I included it in my example above) and references the "name" attribute of the <halfling> node. So... "Halfling" is the answer and the path is:

<missleweaponbonus> . -> starting node
<traits> .. -> next up
<halfling> ... -> the target node on which we search for "name" node!


Thanks Trenloe for helping me while you helped the other guy. I'd get a beer but I NEVER drink and read bedtime stories!


Yours responsibly in nighttime reading,
Dan