STAR TREK 2d20
  1. #1
    Varsuuk's Avatar
    Join Date
    Dec 2015
    Location
    New York
    Posts
    2,075

    Embarrassed to ask (getValue with "..." in path question)

    [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

    Code:
    ...
    		-- 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?

    Code:
    	<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>
    ...
    Last edited by Varsuuk; May 19th, 2019 at 02:55.

  2. #2
    Varsuuk's Avatar
    Join Date
    Dec 2015
    Location
    New York
    Posts
    2,075
    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:

    Code:
    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

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
  •  
DICE PACKS BUNDLE

Log in

Log in