PDA

View Full Version : Unexpected unlabelled characteristics.



GMBazUK
June 14th, 2011, 22:17
Ok, time to reveal my latest conundrum (for me at least).

I've been following the Anatomy of a Rule-set example, and have successful modified it, and implemented into my rule-set. So far so good.

Now when I try to create another windowlist/windowclass in a similar vein, (for another rule-set I'm working on), it doesn't want to play ball.

What happens is it generates a windowlist of characteristics as expected with their related numberfields, except that the first characteristic "label" (the word Strength) appears below two unlabelled characteristic entries.

At first I thought it was to do with something incorrectly anchoring to something else, which was messing with the overall formatting for the list, but I've checked and everything is as it should be.

The only thing I have changed is the number of characteristics (reducing the number to four).

Thanks in advance

Baz.

Sorcerer
June 14th, 2011, 22:43
its difficult to tell would seeing the code...

are you using the same character/campaign that you used when you still had 6 characteristics?
if so it could just be residual windows in the database - try creating a new character and see if he is normal, otherwise I think we need to see the code in order to comment.

Moon Wizard
June 15th, 2011, 09:01
Usually, when I see extra uninitialized window popping up in my windowlists, it's because I am accidentally creating fields at the wrong level. (i.e. creating a number field under the windowlist node) You can usually see this in the db.xml file for the campaign if this is happening.

Even if you aren't creating nodes explicitly, you might be using a template which is creating fields (such as linkednumber).

The key is to check the database to see what the offending node name is, then fix the paths in your code.

This may not be the problem, but it has happened to me often enough during my ruleset development time.

Cheers,
JPG

GMBazUK
June 15th, 2011, 09:17
To begin with I will follow up on your suggestions Moon Wizard, and check for linked number fields etc.

As far as I remember the structure of the code, has no unnecessary numberfields placed in the windowlist for example, although I did create a numberfield which was located in the overview frame, and saving its data to the characteristics section of the database, but when I removed it, no improvement.
I have also tried commented out large sections of my XML and LUA to try and narrow down the offending code, but to no avail.
I looked at the database to see if these unlabelled numberfields were in there, but they weren't!?
I even thought, not only to open a new character, but delete my "testCampaign", and create a new one, so as to purge the database (so to speak).
If I can't find a solution following your suggestions Moon Wizard, I will post some code later as per Sorcerers advice.

Thank you both, again.

Baz.

Moon Wizard
June 15th, 2011, 09:22
When you get the extra windows, type "/save" on the command line, then look at the db.xml for that windowlist node. (or post the snippet for the windowlist node here)

Cheers,
JPG

GMBazUK
June 15th, 2011, 10:05
Here is everything I think you will need.

Please note, I have modified the way the generic control which the windowlist anchors to is set up, using positioning rather than bounds.

The database is from a recent /save of the campaign:

<?xml version="1.0" encoding="iso-8859-1"?>
<root version="2.8" release="0.6">
<charsheet>
<id-00001>
<languagelist>
</languagelist>
<statistics>
<AGI>
<statbonus type="number">0</statbonus>
<statcur type="number">0</statcur>
<statperm type="number">0</statperm>
<statroll type="number">0</statroll>
</AGI>
<DEX>
<statbonus type="number">0</statbonus>
<statcur type="number">0</statcur>
<statperm type="number">0</statperm>
<statroll type="number">0</statroll>
</DEX>
<INT>
<statbonus type="number">0</statbonus>
<statcur type="number">0</statcur>
<statperm type="number">0</statperm>
<statroll type="number">0</statroll>
</INT>
<STR>
<statbonus type="number">0</statbonus>
<statcur type="number">0</statcur>
<statperm type="number">0</statperm>
<statroll type="number">0</statroll>
</STR>
<weight type="number">0</weight>
<weightroll type="number">0</weightroll>
</statistics>
</id-00001>
</charsheet>
<effect>
</effect>
<image>
</image>
<modifier>
</modifier>
<note>
<holder name="GMBazUK" owner="true" />
</note>
<preference>
<ChatPortraits type="string">No</ChatPortraits>
<CombatTrackerShowNPC type="string">Toggle</CombatTrackerShowNPC>
<CombatTrackerShowStats type="string">No</CombatTrackerShowStats>
<SecretBox type="string">No</SecretBox>
<ShowTotals type="string">No</ShowTotals>
</preference>
</root>

Here is the windowlist entry from Charsheet_main

<genericcontrol name="statisticsframe">
<anchored>
<to>overviewframe</to>
<position>belowleft</position>
<offset>0,0</offset>
<size>
<width>302</width>
<height>150</height>
</size>
</anchored>
<frame>
<name>sheetgroup</name>
</frame>
</genericcontrol>

<!--------------------STATISTICS FRAME TOP LABELS---------------->

<stringcontrol name="primlabel">
<anchored>
<to>statisticsframe</to>
<position>insidetopleft</position>
<offset>15,10</offset>
<size>
<width>120</width>
</size>
</anchored>
<font>sheetlabel</font>
<static>Primary statistics</static>
</stringcontrol>

<stringcontrol name="roll">
<anchored>
<to>primlabel</to>
<position>right</position>
<offset>5,-2</offset>
<size>
<width>35</width>
</size>
</anchored>
<font>sheetlabelsmall</font>
<static>Roll</static>
<center/>
</stringcontrol>

<stringcontrol name="perm">
<anchored>
<to>roll</to>
<position>right</position>
<offset>5</offset>
<size>
<width>35</width>
</size>
</anchored>
<font>sheetlabelsmall</font>
<static>Perm</static>
<center/>
</stringcontrol>

<stringcontrol name="bon">
<anchored>
<to>perm</to>
<position>right</position>
<offset>5</offset>
<size>
<width>35</width>
</size>
</anchored>
<font>sheetlabelsmall</font>
<static>Bonus</static>
<center/>
</stringcontrol>

<stringcontrol name="cur">
<anchored>
<to>bon</to>
<position>right</position>
<offset>5</offset>
<size>
<width>35</width>
</size>
</anchored>
<font>sheetlabelsmall</font>
<static>Cur</static>
<center/>
</stringcontrol>

<!---------STATISTICS ENTRIES------------------------->
<windowlist name="statistics">
<anchored>
<to>statisticsframe</to>
<position>over</position>
<offset>-15,-25</offset>
</anchored>
<class>charsheet_primarystatistics</class>
<datasource>.statistics</datasource>
<noscroll/>
<script>
STR = nil;
AGI = nil;
DEX = nil;
INT = nil;
local order = 1;

function onInit()
STR = addEntry("STR","STRENGTH");
AGI = addEntry("AGI","AGILITY");
DEX = addEntry("DEX","DEXTERITY");
INT = addEntry("INT","INTELLIGENCE");
applySort();
end

function addEntry(name, label)
local node = getDatabaseNode().getChild(name);
local win = nil;
if not node then
node = getDatabaseNode().createChild(name);
end
for i,w in ipairs(getWindows()) do
if w.getDatabaseNode().getName()==name then
win = w;
end
end
if win then
win.label.setValue(label);
win.order.setValue(order);
order = order + 1;
end
return win;
end

function onSortCompare(w1, w2)
return (w1.order.getValue() &gt; w2.order.getValue());
end
</script>
<skipempty/>
</windowlist>

Here is the windowclass data for the windowlist from Charsheet_listclasses:

<windowclass name="charsheet_primarystatistics">
<!-- This bit sets the line height spacing for the stats in the box-->
<sizelimits>
<maximum>
<height>26</height>
</maximum>
<minimum>
<height>26</height>
</minimum>
</sizelimits>
<sheetdata>

<numbercontrol name="order">
<bounds>0,0,0,0</bounds>
<invisible/>
</numbercontrol>

<stringcontrol name="label">
<anchored>
<position>insidetopleft</position>
<offset>0,10</offset>
<size>
<width>35</width>
<height>20</height>
</size>
</anchored>
<font>sheetlabel</font>
<static/>
</stringcontrol>

<!-- Stat Roll,Perm,Bonus,Curr Entry boxes-->

<numberfield name="statroll">
<anchored>
<position>insidetopleft</position>
<offset>120,6</offset>
<size>
<width>30</width>
<height>20</height>
</size>
</anchored>
<font>sheetnumber</font>
<frame>
<name>modifier</name>
<offset>5,4,5,4</offset>
</frame>
<nodrag/>
</numberfield>

<numberfield name="statperm">
<anchored>
<to>statroll</to>
<position>right</position>
<offset>10</offset>
<size>
<width>30</width>
</size>
</anchored>
<font>sheetnumber</font>
<frame>
<name>modifier</name>
<offset>5,4,5,4</offset>
</frame>
<displaysign/>
<nodrag/>
<readonly/>
</numberfield>

<numberfield name="statbonus">
<anchored>
<to>statperm</to>
<position>right</position>
<offset>10</offset>
<size>
<width>30</width>
</size>
</anchored>
<font>sheetnumber</font>
<frame>
<name>modifier</name>
<offset>5,4,5,4</offset>
</frame>
<keyeditframe>
<name>sheetfocus</name>
<offset>5,4,5,4</offset>
</keyeditframe>
<font>sheetnumber</font>
<noreset/>
</numberfield>

<numberfield name="statcur">
<anchored>
<to>statbonus</to>
<position>right</position>
<offset>10</offset>
<size>
<width>30</width>
</size>
</anchored>
<frame>
<name>modifier</name>
<offset>5,4,5,4</offset>
</frame>
<font>sheetnumber</font>
<nodrag/>
<noreset/>
</numberfield>

</sheetdata>
</windowclass>

Baz.

Sorcerer
June 15th, 2011, 11:14
It appears to be exactly as M_W predicted (he is usually right in these things)
<weight type="number">0</weight>
<weightroll type="number">0</weightroll>

these are appearing in your windowlist and causing the blank windows to show.

However I do not see any reference to them in any of the code posted. but clearly they are being created at the wrong level.

If the names are unknown to you, i.e. you did not create these fields, then it could be as M_W says that they are part of a template, but you need to search the code to find any references to them, and then we can decide what to do about them.

GMBazUK
June 15th, 2011, 11:56
Aargh!

I did indeed create these numberfields (which reside in the overviewframe), and had in my earlier "commenting out" removed them to see if they had anything to do with the issue. I guess I just didn't check thoroughly enough.

I have now removed them from the statistics databasenode, and all is well.

In all honesty, when Moon Wizard said..."it's because I am accidentally creating fields at the wrong level. (i.e. creating a number field under the windowlist node)", I didn't fully understand; but I now see that the .statistics <datasource> reserves that section of the database for the windowlist alone, and doesn't merely allocate a space and call it "statistics".

Nuances can be a nuisance (for me at least).

Thank you guys.

Baz.

Moon Wizard
June 16th, 2011, 00:30
You don't know how many times I've done this myself when creating new window classes. I just recognize it faster now. ;)

JPG