5E Product Walkthrough Playlist
  1. #1

    DB.getValue()... impossible return value...

    Okay... I am trying to get a value of a node "hitDice" and the return is "hitDice" not the value of the node.

    if this:

    Code:
    local _, nodeNPC = ActorManager.getTypeAndNodeName(rSource);
    Debug.console("manager_action_damage","getTable48HitDiceVsImmunity","nodeNPC",nodeNPC);
    Runtime Notice: s'manager_action_damage' | s'getTable48HitDiceVsImmunity' | s'nodeNPC' | s'combattracker.list.id-00004'
    Code:
    ..
    	<combattracker>
    		<public />
    		<list>
    			<public />
    			<id-00004>
    ...
    				<hitDice type="string">4+1</hitDice>
    ...
    Code:
    local sHitDiceString = DB.getValue(nodeNPC, "hitDice");
    Debug.console("manager_action_damage","getTable48HitDiceVsImmunity","sHitDiceString",sHitDiceString);
    How the heck can I get this:
    Runtime Notice: s'manager_action_damage' | s'getTable48HitDiceVsImmunity' | s'sHitDiceString' | s'hitDice'
    ---
    Fantasy Grounds AD&D Reference Bundle, AD&D Adventure Bundle 1, AD&D Adventure Bundle 2
    Documentation for AD&D 2E ruleset.
    Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)
    Note: Please do not message me directly on this site, post in the forums or ping me in FG's discord.

  2. #2
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,411
    nodeNPC is a string, not a DB node.

    Therefore, the second argument to DB.getValue is the default to return if the value from the first argument isn't valid. So, you're getting the default returned = "hitDice".

    Info here: https://fantasygroundsunity.atlassia...29/DB#getValue

    The second parameter is an optional subpath which is:
    subpath (string) [optional]
    If the first parameter has type databasenode, then this parameter specifies the relative data node identifier path from the specified node object.
    Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!

  3. #3
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,411
    To make it work, you could use:

    Code:
    DB.getValue(DB.getChild(nodeNPC, "hitDice"));
    Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!

  4. #4
    Okay, I figured it out. The value of nodeNPC from the getTypeAndNodeName() is a string, not a node... I actually had meant to use getTypeAndNode anyway...

    That said, the second call that I tested DB.getValue(nodeNPC,"frequecy") returned a value... not "frequency". I tested it when I noticed hitDice wasn't working.

    Strange happenings but for now im good.
    ---
    Fantasy Grounds AD&D Reference Bundle, AD&D Adventure Bundle 1, AD&D Adventure Bundle 2
    Documentation for AD&D 2E ruleset.
    Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)
    Note: Please do not message me directly on this site, post in the forums or ping me in FG's discord.

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