STAR TREK 2d20
  1. #1

    Unbound windowclass needs bound!

    I have this windowclass that I've created, and in the onInit() function, I'm doing Debug.console("Node", getDatabaseNode). This shows as 'nil'. I don't want this nil, I want it attached to a database node. I've tried adding "<datasource>", but it has no effect.

    According to the docs, this means my windowinstance is "unbounded". How do I get it bounded? I've tried looking through the RPGCore ruleset, and in fact I based my window off of those, but those are somehow bound, while mine is not. In the ManagerDesktop.lua script there is createDockShortcut that creates a referencecontrol and then seems to bind the window with the db node (control.setValue("notelist", "notes"), for example). I tried doing something similar, but my window remains unbounded.

    Help please!

  2. #2
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,408
    Quote Originally Posted by jreddin1 View Post
    In the ManagerDesktop.lua script there is createDockShortcut that creates a referencecontrol and then seems to bind the window with the db node (control.setValue("notelist", "notes"), for example).
    This code doesn't do the database binding at this point - it creates the data that will be used when the shortcut is pressed (one of the icons on the right of the desktop). To use your example of the notes list, the following code in desktop\scripts\desktop.lua: DesktopManager.registerDockShortcut2("button_notes ", "button_notes_down", "sidebar_tooltip_note", "notelist", "notes"); Creates the notes button on the right hand side of the desktop and when it is pressed the notelist windowclass will be created using notes as the base database reference.

    How are you creating your window?
    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
    I'm creating the window using the /openwindow command.

    I've got it to the point where I can create a window that creates a referencecontrol that binds my window, or I can use the DesktopManager.registerStackShortcut2 and those both bind it to a datasource. So at least I know that works :-)

    I don't want to do it that way, though. I really want to keep it launched from the /openwindow command, and I thought <datasource>.whatever</datasource> would do that, but it doesn't work as advertised.

    I was even trying to figure out if I could get a referencecontrol to my window, and then use setValue, but I'm not making headway there.

  4. #4
    This probably isn't the right thing to do, but to get past this problem, I added an onInit function in my main lua script. In there, I do a "findNode", and use it to set a global that I can refer to in the things that are under the windowclass, but need access to the data. It's kludgey, but it got me past this.

  5. #5
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,408
    Quote Originally Posted by jreddin1 View Post
    I really want to keep it launched from the /openwindow command, and I thought <datasource>.whatever</datasource> would do that, but it doesn't work as advertised.
    Use: /openwindow notelist notes for example. Don't enclose the datasource in XML, just use the name.
    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!

  6. #6
    Doh! Brilliant! Thank you very much! That get's me past that from a window launch perspecive.

    Of course, that lead me to another problem. I managed to get everything working on the Host; I can open the window, resize, add items, delete items, click my action button, etc. And everything persists in the DB like it should. Unfortunately, I couldn't open the window using the /openwindow method when I joined as a player. No error, just no window. Not sure why. So I went ahead and used registerStackShortcut2, at least for now. Now the window opens when I've joined as a player (and click the stack icon), but no data shows up!

    A Debug.console for window.getDatabaseNode() is pointing to the right node, but it doesn't read the data in (like it does on the host), nor does it let me add any data -- even though I get no console warnings or errors. I'm guessing there's something I need to set to allow the player to write to that node and below, I just don't know what it is. I tried "<playercontrol />" and "<shareable />" but they don't seem to help.

    Suggestions? And thanks for your help!

  7. #7
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,408
    /openwindow is really only supposed to be used during development/debugging, so it's not really appropriate from a player side perspective.

    Data is usually accessible by the user that created it. See if you can add some data from the player side and see if they can see it. The GM can see all info (added by them and the players), but the players usually only see info added by them or info that has been shared with them.

    Additional things that might be blocking the player viewing objects:

    • See if any of the controls have <gmvisibleonly /> or similar tags.
    • If you have any code used to populate the GUI/data, there may be some if User.isHost() entries in the code that only runs for


    Look at the campaign notes classes for some examples of how to go about this. The notes list allows players to add entries, share with other players, etc.. The base windowclass entries are in the CoreRPG ruleset, campaign\campaign_notes.xml.
    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!

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
  •  
5E Product Walkthrough Playlist

Log in

Log in