5E Product Walkthrough Playlist
  1. #1

    Help with windowlist and databasenode problem.

    Hi All,

    I have been driving myself crazy with a problem whilst coding for an extension (testing in FGU, but think it would apply to either), i am sure is something simple but cant figure it out.

    Originally I was storing my own copy of token, ID etc of entries into the combat tracker and using handlers to update them. However, this quickly became a performance issue when there was more than 8 or so NPCs.

    So I figured, why am I creating a new DB, when I can just use the combat tracker directly, and add a couple of extra fields myself. However, I just cant get the NPCs to display in my window. I've been debugging and it must be somethign to do with the databasenode, as if I call getDtabaseNode() with my entry script it returns nil, but if I call window.getDatabaseNode() within my entry.xml it returns the correct combat tracker entry ID.

    I am using a windowlist with datasource "combattracker.list" and have my own script <script file="scripts/rfia/rfia_npcs.lua" /> included in that windowlist. It refers to a windowclass which I have created <windowclass name="rfia_npc_entry"> , which also has its own script rfia_npc_entry.lua.

    I created an init method in both scripts to debug. For the windowlist script, it gets the database node (getDatabaseNode()) as expected "combattracker.list". However, for the entry script it returns nil for the databasenode. I know that the correct number of entry windows are being created because the number of debug calls = number of NPCs in combattracker.

    Hope this makes sense. So in conclusion I just think somehow the databas enode/window isnt properly connecting to the script or vice versa.

    Let me know your thoguhts!

    Thank you!

  2. #2
    I think the problem is, is that the overarching window has my custom datasource, but the windowlist has a different datasource (combattracker.list). I think the entry might not like that difference. Not sure if this is possible?

  3. #3
    I would add onInit functions to every window and windowlist in your custom code (and maybe in some of the controls too); and output the database node at every step. In that way, you can figure out whether the database nodes are correct at every level.

    Regards,
    JPG

  4. #4
    Thank you moon wizard,

    That helped me to find the issue with the node!

    However, the token value doesnt seem to automatically take its value from the DB, I have to manual set the token with "token.setPrototype(DB.getValue(getDatabaseNod e(), "token", "token", ""));"

    I have a token control:
    <tokencontrol name="token">
    <anchored width="40" height="40">
    <top parent="columnanchor" anchor="bottom" offset="10"/>
    <left offset="10"/>
    </anchored>
    <readonly />
    <nodrag />
    <nodrop />
    <empty>token_empty</empty>
    </tokencontrol>
    Its name is token, which is the same as in the combat tracker.xml.

    If this is what I have to do thats fine, but was hoping to avoid having to call unnecessary extra getDB calls.

  5. #5
    Damn, all of this was because I used tokencontrol instead of tokenfield . Well you live and learn!

  6. #6
    Glad you figured it out. You're doing pretty well so far!

    Cheers,
    JPG

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