PDA

View Full Version : Additional "cloned" tab in charsheet



Kilitar
December 7th, 2014, 16:19
Hello.

My issue is, in my own game system (without advanced game mechanics programmed into ruleset i am not able to do with my skill ATM) I need to have alot of informations related to atributes and skills inside charsheet.

I thought simple yet elegant workaround could be separate Atributes tab and Skill tab into two tabs in charsheet.
I spent 5 hours to achieve this probably simple task and failed. Reading guides, looking for video tutorials but every attemp ends with "exacly cloned tabs" - when I do anything inside main "atributes tab", the second main "skills tab" have exact data copy inside it and vice versa.

When I look into db.xml, only one data node is here so I am displaying and writing only one group of data instead of two.

I am lost inside all that reference logic jumping from one file to another looking for where is what :). trying to change something and trying to figure results of my change. Its pretty hard with almost no debug options inside FG a and almost zero commentary inside files. (my programming experience is based on Basic, Pascal, C++ from pre OOP/DOS era so all that encapsulation stuff troubles me).

I made additional TAB copy record_char_main.xml into record_char_main2.xml, included it in base.xml and add it as additional "subwindow" inside record_char.xml. Then i was toying inside record_char_main2.xml, trying something inside template_char.xml but no luck.

Any advice?

Thanks.

dulux-oz
December 7th, 2014, 16:39
Sounds like nodes in the Database is being reference by both pages - nodes are "linked" to screen elements either via their "name" attribute or a "source" attribute - I'd check both of your new pages for duplicates in these areas, if I were you. :)

Have fun

Cheers

Kilitar
December 7th, 2014, 17:53
Sounds like nodes in the Database is being reference by both pages - nodes are "linked" to screen elements either via their "name" attribute or a "source" attribute - I'd check both of your new pages for duplicates in these areas, if I were you. :)

Have fun

Cheers

Thanx Dulux - watched alot of your VIDS on youtube last 2 weeks :) - and you are main reason why I spent 20% of my monthly sallary into ultimate version of FD.

One small question - I thought "template" files (like template_char.xml ) are just reference types instead of "real charsheet stuff" so I dont need change them in this case. And *.lua files are again reference scrips I also dont need access them for this task so whole "editing magic" should be hidden inside record_char_main.xml, am I right? :)

Sorry for my english, I spent my school years under russian iron courtain so its my another issue i am dealing with when I try to learn something from guides, my english is based on self-learning and movies subtitles :).

Trenloe
December 8th, 2014, 02:16
One small question - I thought "template" files (like template_char.xml ) are just reference types instead of "real charsheet stuff" so I dont need change them in this case. And *.lua files are again reference scrips I also dont need access them for this task so whole "editing magic" should be hidden inside record_char_main.xml, am I right? :)
Templates are usually for XML specifications that are going to be used more than once, so they can (and do) contain "real stuff". Also, LUA is code that can be manipulating the database directly, so it might be that there is some hard coded database references in LUA files.

The issue you're having is that the data stored from the Main tab is stored in 2 windowlist controls which are defined in template_char.xml: <template name="list_charmaincategory"> and
<template name="list_charmainattribute">. Both of these have a <datasource> entry that determines where their data is stored in the database - list_charmaincategory has a datasource of .maincategorylist and list_charmainattribute has a datasource of .attributelist - which you will see looking at a <charsheet> entry in the campaign db.xml file.

As a minimum you'll need to change the <datasource> entry for these 2 templates in your new control definitions in record_char_main2.xml. You can do this using the mergerule="replace" parameter within the XML. For example, the following will replace the template <datasource> entry:

<list_charmaincategory name="categories">
<windowlist>
<datasource mergerule="replace">.maincategorylist2</datasource>
</windowlist>
<anchored to="attributesframe">
<left offset="15" />
<top offset="35" />
<right offset="-15" />
<bottom offset="-20" />
</anchored>
</list_charmaincategory>
Use the above code in your record_char_main2.xml for the categories windowlist, the red highlights that this control will use a datasource of maincategorylist2 for the category headers. There is no need to change the underlying attributelist control as this will be embedded within the new maincategorylist2 database structure.

More info on templates and merge rules here: www.fantasygrounds.com/modguide/templates.xcp

Kilitar
December 8th, 2014, 10:44
Thx Trenloe.
Add your code in case of both did not work for me, dunno why - tabs were still cloned in old characters and even in new ones.


<list_charmaincategory name="categories">
<windowlist>
<datasource mergerule="replace">.maincategorylist2</datasource>
</windowlist>
and

<list_charmainattribute name="attributes">
<windowlist>
<datasource mergerule="replace">.attributelist2</datasource>
</windowlist>


Anyway you pointed me to right part of code so I did it "dumb manual way".

Code:

<list_charmaincategory2 name="categories">
<anchored to="attributesframe">
<left offset="15" />
<top offset="35" />
<right offset="-15" />
<bottom offset="-20" />
</anchored>
</list_charmaincategory2>

and with clone part of template_char.xml

<template name="list_charmaincategory2">
<windowlist>
<class>char_main_category</class>
<datasource>.maincategorylist2</datasource>
.
.


My code now working as I need - anyway its just dumb code duplication so I would like to figure what I did wrong with your "merge magic :)"

Based on your and Dulux advices I moved from nowhere to somewhere forward I suppose.

Thank you for your time.