PDA

View Full Version : Reusing list_text in another window



LordEntrails
December 17th, 2024, 17:54
So I am trying to take a list of skills from the charactersheet (custom ruleset) and re-use it in the NPC. But I can't get the skills window to show in the NPC object in FG. No errors are thrown.

Here's the code in the "charsheet_main":


<list_text name="skills_list">
<frame name="frame_windowlist" offset="3,25,3,3" />
<anchored>
<left offset="142" />
<right offset="-18" />
<top offset="30" />
</anchored>
<class>skills_charsheet</class>
<datasource>.skillslist</datasource>
<allowcreate />
<allowdelete />
<acceptdrop>
<class>skills</class>
<field>*</field>
</acceptdrop>
<columns>
<width>362</width>
</columns>
</list_text>
<genericcontrol name="skills_label">
<bounds>139,5,140,21</bounds>
<icon>skills_label</icon>
</genericcontrol>
<button_iedit name="skills_list_iedit">
<bounds>-40,8,20,20</bounds>
<icon normal="button_edit" />
<font>button-white</font>
<target>skills_list</target>
</button_iedit>
<button_iadd name="skills_list_iadd">
<bounds>-62,8,20,20</bounds>
<icon normal="button_add" />
<font>button-white</font>
<target>skills_list</target>
</button_iadd>
<scrollbarcontrol name="skills_scrollbar">
<frame name="scrollbar_base" offset="0,12,0,12" />
<bounds>504,47,8,236</bounds>
<target>skills_list</target>
<normal name="scrollbutton_normal">
<minimum height="scrollbutton_normal" />
</normal>
</scrollbarcontrol>


And here is the code in the "sub_npc_major" (which is visible when npc_type is visible and is a sub window of npc_main):

<list_text name="skills_list">
<frame name="frame_windowlist" offset="3,25,3,3" />
<anchored>
<left offset="10" />
<right offset="-176" />
<top offset="169" />
</anchored>
<class>skills_charsheet</class>
<datasource>.skillslist</datasource>
<allowcreate />
<allowdelete />
<acceptdrop>
<class>skills</class>
<field>*</field>
</acceptdrop>
<columns>
<width>362</width>
</columns>
</list_text>


Is my assumption simple wrong that I can re-use this code so that I only have to maintain it in one place?
edit: sorry, indention is not pasting from NPP and not holding when done manually

superteddy57
December 17th, 2024, 18:15
I would ensure the subwindow initializes and is visible. I'm not seeing any other scripts so both lists from my perspective will be empty. You might want to look into using layout controls as it would cut down on the code you are using to generate the controls. Those can be seen in CoreRPG.

superteddy57
December 17th, 2024, 18:16
If you need a demo of the new layout (standardization) reach out to me in discord.

damned
December 17th, 2024, 21:36
I think if you remove the . from the .skillslist it will create a root node with the skills list
Right now the .skillslist is being created under the charsheet/npc entry...?

LordEntrails
December 18th, 2024, 00:29
Thank you both. Dom's clue was it, there simple was no values in the list so their was nothing showing. I added the iadd and iedit buttons and once you add a value it shows up just fine