DICE PACKS BUNDLE
  1. #1
    Xarxus's Avatar
    Join Date
    Mar 2019
    Location
    Rome (Italy)
    Posts
    253

    Merge classes - campaign_chars and list_iadd

    I'd like to modify charselect_host and charselect_client (campaign_chars.xml)
    to force list_iadd to do something I want. So I've prepared a campaign_chars.xml version and used merge="join".
    Code:
    <windowclass name="charselect_host" merge="join">
       <sheetdata>
          <button_iadd name="list_iadd">
             <anchored to="rightanchor">
                <top />
                <right anchor="left" relation="relative" offset="-5" />
             </anchored>
             <class>charsheet</class>
             <script>
                function onInit()
                   Debug.console("onInit")
                end
                function onButtonPress()
                   Debug.console("onButtonPress", window.getDatabaseNode());
                end
             </script>
          </button_iadd>
    
       </sheetdata>
    </windowclass>
    	
    <windowclass name="charselect_client" merge="join">
       <sheetdata>
          <button_iadd name="list_iadd">
             <anchored to="rightanchor">
                <top />
                <right anchor="left" relation="relative" offset="-5" />
             </anchored>
             <class>charsheet</class>
             <script>
                function onInit()
                   Debug.console("onInit")
                end
                function onButtonPress()
                   Debug.console("onButtonPress", window.getDatabaseNode());
                end
             </script>
          </button_iadd>
    
       </sheetdata>
    </windowclass>
    When i test this code I've the right messages in console, but it alsto creates a new
    entry inside the charsheet tag. I guess is done by the old code
    Code:
    ...
    local node = DB.createChild(window.getDatabaseNode());
    ...
    Surely merge="join" isn't right, so tried a combination of replace, merge and whatsover,
    even on
    Code:
    <button_iadd name="list_iadd">
    without any success.

    How can I do it?
    Last edited by Xarxus; August 27th, 2023 at 16:53. Reason: indent
    FGU ULTIMATE License
    Click here for RPG Music or here for Dwarves songs on Spotify

  2. #2
    Xarxus's Avatar
    Join Date
    Mar 2019
    Location
    Rome (Italy)
    Posts
    253
    I think I found why it creates a new charsheet.
    In the function onButtonPress I was operning my charwizard with this code.
    Code:
    Interface.openWindow("charwizard", window.getDatabaseNode());
    On guides I found this
    Creates a top level window by a windowclass and a datasource. If a matching window already exists, it is returned. Otherwise, a new window is created.
    FGU ULTIMATE License
    Click here for RPG Music or here for Dwarves songs on Spotify

  3. #3
    Character wizards should be sourceless (i.e. "" for data path in Interface.openWindow), in order to avoid creating data until the character has been committed. That's how all of our character wizards work.

    On a related note, the template used for "list_iadd" is changing in the upcoming release this week. You'll need to update your scripts.

    Another option for character wizard is to add a top-level button (like 5E) or to add a new button (next to iadd) that opens wizard instead of blank character.

    Regards,
    JPG

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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 Character Create Playlist

Log in

Log in