Starfinder Playlist
Page 1 of 2 12 Last
  1. #1

    Party inventory control only rendering for host

    Hello,
    I am extending my search extension to add a search control to the party inventory ("ps_inventory"). I am merging my windowclass with that one, and it works well from the host side. The weird thing is that connected clients do not get the search input box, but they do see the empty text placeholder ("Search"). The code is straightforward:
    Code:
    <?xml version="1.0" encoding="iso-8859-1"?>
    <root>
        <windowclass name="ps_inventory" merge="join">
            <script file="scripts/inventory_search.lua"/>
    
            <sheetdata>
                <basicstring name="inv_search_input">
                    <anchored to="itemlist" position="aboveleft" offset="5,25" width="100"/>
                    <empty>
                        <textres>search</textres>
                    </empty>
                    <tabtarget next="inv_search_input" prev="itemlist"/>
                </basicstring>
    
                <buttoncontrol name="inv_search_clear_btn">
                    <anchored to="inv_search_input" position="right" offset="10,0" relation="relative" width="20"/>
                    <icon normal="button_clear" pressed="button_clear_down"/>
                    <invisible/>
                    <tooltip textres="tooltip_clear"/>
                </buttoncontrol>
            </sheetdata>
        </windowclass>
    </root>
    This is the host view:
    host.jpg

    This is the client view:
    client.jpg

  2. #2
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,361
    What is your scripts/inventory_search.lua <script> doing? This will be overriding the ps/scripts/ps_inv.lua script that is set for the base ps_inventory windowclass. You may need to add some super code to the inventory_search.lua code to call the ps_inv.lua code.
    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
    Quote Originally Posted by Trenloe View Post
    What is your scripts/inventory_search.lua <script> doing? This will be overriding the ps/scripts/ps_inv.lua script that is set for the base ps_inventory windowclass. You may need to add some super code to the inventory_search.lua code to call the ps_inv.lua code.
    Not very much, but it's not calling any super. You can see it here.

    If I'm doing a merge, are you sure it's overriding? The same script is used for normal inventory search and it's not interrupting the char_inventory that's in that merge target.

  4. #4
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,361
    Quote Originally Posted by anathemort View Post
    Not very much, but it's not calling any super. You can see it here.
    I can't access that.

    Quote Originally Posted by anathemort View Post
    If I'm doing a merge, are you sure it's overriding? The same script is used for normal inventory search and it's not interrupting the char_inventory that's in that merge target.
    Scripts don't fully merge, they form a layered hierarchy if the function names are the same - with the earlier defined script functions accessible through the super variable - see here: https://fantasygroundsunity.atlassia...pt-Block-Scope
    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
    I can't access that.


    Scripts don't fully merge, they form a layered hierarchy if the function names are the same - with the earlier defined script functions accessible through the super variable - see here: https://fantasygroundsunity.atlassia...pt-Block-Scope
    Sorry, I fixed the access issue. Can you see if there's an issue there? Do I need to call super onInit?

  6. #6
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,361
    You should have this at the beginning of your onInit function:

    Code:
    	if super and super.onInit then
    		super.onInit();
    	end
    The other functions in ps_inv.lua have different names to the functions in your invesntory_search.lua file, so these should be still available - but you should test to ensure these are still running correctly as I haven't tried this in anger in FGU.
    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!

  7. #7
    After adding that snippet, and only that, it's actually worse The placeholder text shows up in the middle of the window now:

    client2.jpg

  8. #8
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,361
    Quote Originally Posted by anathemort View Post
    After adding that snippet, and only that, it's actually worse The placeholder text shows up in the middle of the window now:

    client2.jpg
    That's because the campaign setting Game (GM) - Party:Show inventory to client is set to Off. The code for that option is ran as part of the original onInit code - so now that you're running that code using super.onInit it's reading the campaign option and not showing the party coins or party items. You can see this code in onOptionChanged in the original ps_inv.lua. So you will have to code in your extension to take into account showing the search controls on the player side only if that campaign option is on.

    Now we've got the correct init code running, let's see what the issue is with that search appearing correctly for the player...
    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!

  9. #9
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,361
    Quote Originally Posted by Trenloe View Post
    Now we've got the correct init code running, let's see what the issue is with that search appearing correctly for the player...
    So, the issue is that the string template used (basicstring) is actually a stringfield control (database bound). As players can't change the database area where that control is bound, then it is shown as read only for the players.

    To make it work, the control needs to be changed to a stringcontrol (no stringfield). Unfortunately there's no basicstring control (not field) template so the frame code from basicstring needs to be included in the XML and the base template needs to be changed to simplestringc.

    So, try this:

    Code:
                <simplestringc name="inv_search_input">
                    <anchored to="itemlist" position="aboveleft" offset="5,25" width="100"/>
                    <empty>
                        <textres>search</textres>
                    </empty>
                    <tabtarget next="inv_search_input" prev="itemlist"/>
    				<frame mergerule="replace" name="fielddark" offset="7,5,7,5" hidereadonly="true" />
    				<stateframe>
    					<keyedit name="fieldfocus" offset="7,5,7,5" />
    					<hover name="fieldfocus" offset="7,5,7,5" hidereadonly="true" />
    					<drophilight name="fieldfocus" offset="7,5,7,5" hidereadonly="true" />
    				</stateframe>				
                </simplestringc>
    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!

  10. #10
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,361
    Note - the earlier comments about the script layering is still very valid - without this the campaign option won't be applied; also if the extension is enabled for a new campaign the coin categories won't be set in the party sheet, as these are built in the base onInit function.

    And you also need to code to hide that search field on the player side if the Party:Show inventory campaign option is set to off, as it makes no sense to show it if the players can't see the party inventory.
    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 Character Create Playlist

Log in

Log in