PDA

View Full Version : Better way to manage module data?



meathome
February 13th, 2014, 21:52
It is very clunky that you have to input data multiple times in a module, once for every entry itself and once every time it is in an list combined with the practice that each node has a unique name it is a lot of extra work. So my idea would be to have a module database with only the references itself in it something like this:



<reference>
<group>
<entry></entry>
</group>
</reference>


Maybe with the same entry and group tag so no more explicitly named <featname></featname> but instead maybe additional properties like name and type. Next step would be a script in the reference library window that generates lists from entries automatically and decides what windowclass to display what with on the fly based on the type node in the entry.

Is this realizable with the current capabilities of FG ? Would I have to rewrite the whole reference library system? What files should I investigate? what was the reason that module DB-s are struktured in this way? It seems really strange and un-xml like to me. If it is not clear what I mean I'll try to explain further (English is not my native language)

Moon Wizard
February 14th, 2014, 00:11
Yeah , I've noticed that too.

To change that, it requires updating the reference list window classes to use the list version of data (if available), or use the link to look up the info.

JPG

meathome
February 16th, 2014, 23:59
I first thought I managed to get it to work in a way I like, I simply merged the list entries and the reference entries in a way that each item has a listlink to itself and then the normal data. It works as long as I use the simple reference list. As soon as I try to do some more complex lists with subgroups, like the original weapon list for example it stops to work. Is there a max depth for the module structure?
My concrete problem:

I have my reference list with skills for iron kingdoms. These skills are divided into 2 subgroups , millitary and occupational skills. In the module data I have it set up like this:

At the top in the library section:


<chapter003_skills>
<librarylink type="windowreference">
<class>reference_skilltablelist</class>
<recordname>reference.skills@Iron Kingdoms Core Rules</recordname>
</librarylink>
<name type="string">Skills</name>
</chapter003_skills>


Then comes the reference part merged with the list part, looks like this


<reference static="true">
<skills>
<description type="string">Skills</description>
<groups>
<section001>
<description type="string">Military Skills</description>
<index>
<archery>
<listlink type="windowreference">
<class>referenceskill</class>
<recordname>reference.skills.groups.section001.index.archery@I ron Kingdoms Core Rules</recordname>
</listlink>
<name type="string">Archery</name>
<type type="string">Military</type>
<stat type="string">Poise</stat>
<text type="formattedtext">
<p>
Each level of this skill adds to the character's POI when making
attacks with bows.
</p>
</text>
</archery>
</index>
</section001>
</groups>
</skills>
</reference>

I have more data I just didn't want to clutter the post too much.

I then made a variation of the window classes for weapons from the 3.5e ruleset to display this data, setting the datasource of the list in the tablegroup windowclass to .index and setting the datasource for the list of groups to .groups.
The results are that the groups are displayed but not the items inside the index part of each group. If I query the items in window.getDatabaseNode().getChild("index"); form the onInit function of the windowlist I can print out the data from the module in the console... If i leave the datasource empty and set it from the lists onInit with setDatabaseNode i get the item names displayed but the links do not work and no other data is displayed.

The windowclasses for displaying it are simply variation of similar windowclasses from the 3.5 ruleset and as I said groups are displyed but the item list inside groups remains empty:


<windowclass name="reference_skilltablelistitem">
<margins control="0,0,0,2" />
<sheetdata>
<linkfield name="listlink">
<bounds>5,2,20,20</bounds>
</linkfield>
<string_list_link name="name">
<bounds>30,2,120,20</bounds>
</string_list_link>

<genericcontrol name="reftableanchor">
<bounds>150,2,0,0</bounds>
</genericcontrol>
<string_reftable name="stat">
<center />
</string_reftable>
<string_reftable name="trainedonly">
<center />
</string_reftable>
</sheetdata>
</windowclass>


<windowclass name="reference_skilltablegroup">
<script file="ref/scripts/ref_listgroup.lua"/>
<sheetdata>
<anchor_column name="topanchor" />

<frame_groupdesc name="descframe" />
<string_groupdesc name="description" />
<string_groupsubdesc name="subdescription" />

<list_reftablegroupitems name="list">
<datasource>.index</datasource>
<class>reference_skilltablelistitem</class>
</list_reftablegroupitems>

<ft_reftablefooter name="footer" />
</sheetdata>
</windowclass>



<windowclass name="reference_skilltablelist">
<frame>referencelist</frame>
<placement>
<size width="750" height="650" />
</placement>
<sizelimits>
<minimum width="750" height="650" />
<dynamic />
</sizelimits>
<minimize>minimized_reference</minimize>
<tooltip field="description" />
<nodelete />
<sheetdata>
<windowtitlebar>
<field>description</field>
</windowtitlebar>

<genericcontrol name="headeranchor">
<bounds>65,45,0,0</bounds>
</genericcontrol>
<label_reftable name="headername">
<anchored width="120" />
<static textres="ref_label_listname" />
</label_reftable>
<label_reftable name="headerstat">
<static >Stat</static>
<center />
</label_reftable>
<label_reftable name="headertrainedonly">
<static>Trained Only</static>
<center />
</label_reftable>


<windowlist name="grouplist">
<bounds>35,80,-40,-70</bounds>
<frame name="groupbox" offset="15,15,20,15" />
<class>reference_weapontablegroup</class>
<datasource>.groups</datasource>
</windowlist>
<scrollbar_reftablegroup />

<filter_reftable name="filter">
<bounds>125,-45,-35,20</bounds>
</filter_reftable>
<button_expand>
<bounds>30,-45,20,20</bounds>
</button_expand>
<button_collapse>
<bounds>60,-45,20,20</bounds>
</button_collapse>

<resize_referencelist />
<close_referencelist />
</sheetdata>
</windowclass>


So back to the question is this all because their is a maximum depth for elements in the module database or do I have some other problem?

The whole motivation behind this was to avoid having to enter the same data multiple times (you can for example have a typo in the list entry or the item name etc) It would be way better to only have to change that at one location.




EDIT: I have found the reason, it was a simple typo on my part... I forgot to change the calss of the grouplist to the new skillgrouplist....

Moon Wizard
February 17th, 2014, 09:45
There's no maximum depth of elements in either the main or module databases. So, it would be somewhere in the windowclasses.

The reason that the lists and items are separate is so that you can potentially have multiple lists with the same items in different order and/or groups. The monster modules for 4E and PFRPG have an alphabetical index list and a difficulty index list.

Regards,
JPG

Zeus
February 17th, 2014, 19:28
For 5E, all the Module data lists use referenced data only (I embed list links where possible), there is minimal duplication of data. 5E also provides several different indexes of certain data classes e.g. NPCs - Alphabetically indexed, NPCs, Level indexed, NPCs - Type indexed, Items - Type Indexed etc. etc. so its definitely doable.

meathome
February 17th, 2014, 20:04
I will need to have a look at how you did it. That is exactly what I was trying to achieve :) All the data duplication felt somehow strange to me, but my design isn't really better.