STAR TREK 2d20
  1. #1

    openWindow() returning nil in classic?

    alright, i got a weird one. in Fantasy Grounds Unity, the following line returns a windowinstance which i can use to get the databasenode from.

    local aNode = Interface.openWindow("npc", "npc.");
    Debug.console(aNode);
    Debug.console(DB.getChildren("npc"));
    aNPCDetails.node = aNode.getDatabaseNode();
    Debug.console(aNPCDetails.node);

    in Fantasy Grounds Classic, aNode comes up nil. What do i need to do so that we create a new npc and return its databasenode in both versions?
    Last edited by pr6i6e6st; July 7th, 2020 at 03:43.

  2. #2
    "npc." is not a valid database path. That's probably the issue.

    JPG

  3. #3
    Quote Originally Posted by Moon Wizard View Post
    "npc." is not a valid database path. That's probably the issue.

    JPG
    Neat/strange that unity can ignore that and create the node. So would I need to createChild() first? Or get a list of children from the npc node, count each and then create a string that reads like local sNode = “npc.id-“ .. 00000 + nCount . . “”;

  4. #4
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,362
    Use createChild: https://fantasygroundsunity.atlassia...DB#createChild or https://fantasygroundsunity.atlassia...de#createChild

    Either will create a unique ID (in the form of id-XXXXX) if the name parameter is omitted, and return a databasenode which can be used in Interface.openWindow
    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!

  5. #5
    Quote Originally Posted by Trenloe View Post
    Use createChild: https://fantasygroundsunity.atlassia...DB#createChild or https://fantasygroundsunity.atlassia...de#createChild

    Either will create a unique ID (in the form of id-XXXXX) if the name parameter is omitted, and return a databasenode which can be used in Interface.openWindow
    Awesome, I’ll give it a whirl later. I thought maybe that’s the extra step needed but I was struggling with the name part. Thank you

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